132 Members
Spatial objects for PostgreSQL | http://postgis.net | logs at https://view.matrix.org/alias/%23postgis:matrix.org3 Servers

Load older messages

Timestamp Message
21 Feb 2019
08:25:21@freenode_sigq:matrix.orgsigqTitle: debian Pastezone (at paste.debian.net)
09:46:23@freenode_Algunenano:matrix.orgAlgunenano joined the room.
10:18:04@freenode_Raticide:matrix.orgRaticide joined the room.
10:19:05@freenode_Raticide:matrix.orgRaticideHi! How would I test if 2 linestrings have any points in common. ST_Touches is pretty close, but only seems to work if one of those points is the end of a linestring. But I want to check if any points are common to both linestrings.
10:21:03@freenode_strk:matrix.orgstrkRaticide: for just materialized points or also in-line intersection (2 segments crossing in the middle?)
10:21:27@freenode_Raticide:matrix.orgRaticide–materialized points only. The exact vertex needs to match.
10:21:52@freenode_Raticide:matrix.orgRaticideI figured maybe converting to an array of points and then just doing an intersect on those 2 arrays?
10:22:04@freenode_strk:matrix.orgstrk I'm afraid that's your only option
10:22:09@freenode_strk:matrix.orgstrk that'd is: ST_DumpPoints
10:22:14@freenode_strk:matrix.orgstrkand ST_Intersection, I guess
10:22:24@freenode_strk:matrix.orgstrkor just equality
10:23:40@freenode_strk:matrix.orgstrk SELECT a.geom FROM ST_DumpPoints(g1) a, ST_DumpPoints(g2) b WHERE g1 && g2 AND a.geom == b.geom; -- something like that
10:23:49@freenode_strk:matrix.orgstrksyntax would probably need some massage
10:24:49@freenode_Raticide:matrix.orgRaticide hmm, I'll have a go. Thanks
10:27:09@freenode_strk:matrix.orgstrkyou may also try WHERE ST_Intersects(g1,g2) and compare speed
10:27:16@freenode_strk:matrix.orgstrk instead of WHERE g1 && g2
10:27:33@freenode_Raticide:matrix.orgRaticideYeah, I already have an intersects check in my query
10:27:40@freenode_strk:matrix.orgstrkit may be faster or slower, depending on which check is more expensive between testing equality of _each_ point after dump and building topology of each line before the dump
10:27:56@freenode_strk:matrix.orgstrkalso, depending on PostGIS version, the a.geom == b.geom may or may not be what you want
10:28:01@freenode_strk:matrix.orgstrkat one point == was bounding-box only check
10:28:05@freenode_strk:matrix.orgstrk (it's = btw, not ==)
10:28:32@freenode_strk:matrix.orgstrkso you may want ST_Equals(a.geom, b.geom) for a very precise comparison instead (ie: 2 slightly off points may have the same boundin gbox)
10:32:56@freenode_Raticide:matrix.orgRaticideOh, yes they have to be completely identical
10:34:26@freenode_velix:matrix.orgvelix joined the room.
10:34:26@freenode_velix:matrix.orgvelix Myon: Yeah, I'm using it from backports, but I guess, most of the guys out there don't.
10:35:11@freenode_velix:matrix.orgvelix Myon: But as long as the "small" backport version is newer than the stable one, it's fine ;)
10:36:22@freenode_Raticide:matrix.orgRaticideSweet, I think my query is working. Thanks strk
11:50:05@freenode_strk:matrix.orgstrk Raticide: FWIW, I've been thinking for some time that we'd need functions to spot those kind of intersections
11:50:38@freenode_strk:matrix.orgstrkit could be useful for some cases, but I always wondered if it was just a need that _I_ had during development or there was a real-world case too

There are no newer messages yet.

Back to Room List