Tag Info

New answers tagged

3

If you are using PostGIS 2.1 or later, ST_Segmentize for the geography type was introduced: ST_Segmentize(geography geog, float max_segment_length) Where geog is a geography object, similar to a geometry with SRID=4326, and max_segment_length is a distance in metres. If you don't want to use geography types, you can cast between like this: SELECT ...


1

Here is another way to remove points from lines using ST_RemovePoint. Assuming table=my_lines and geometry field=geom. UPDATE my_lines SET geom = ST_RemovePoint(geom, t.pt_num-1) FROM (SELECT line_id, pt_num FROM (SELECT id line_id, (ST_DumpPoints(geom)).path[1] pt_num, (ST_DumpPoints(geom)).geom geom FROM my_lines) my_points WHERE ST_Equals(geom, ...


2

One way to do this would be to use ST_DumpPoints to get individual points and then ST_MakeLine to rebuild the LineString, with a NOT ST_EQUALS in the WHERE clause to eliminate the Point(0,0); WITH lines (ls) AS (VALUES (ST_GeomFromText('LINESTRING(-1 -1, 0 0, 1 1, 2 2)'))), dumped (pts) AS (SELECT (ST_DumpPoints(ls)).* FROM lines) ...


1

I assume that the polyline is unbounded; that is, either the polyline comprises a single line or the first and last pieces are rays. Otherwise, the problem is not well defined. You can use the CGAL 2D-Arrangement data structure to solve your problem easily: Construct a 2D-Arrangement induced by the polyline and issue two point locations queries for A and B, ...


0

Please check isLeft() function in this link.


0

My idea is to make line from A and B points (AB). And Find the crossing points AB and L. If 0 than A and B on the same side, if 1 they aren't. If you have more than one it means A and B on the same side just like in the first case. (It may can happen sometimes AB above Lp1 or below Lpn- so it would be better to extend L endpoints with a distance n) Another ...


1

My idea may not be most efficient but anyway, I believe you can at least get a correct answer by creating offset lines to the left and to the right from linestring L and computing shortest distances from A and B to the offset lines. If both A and B have shorter distance to the same offset line it means that they are on the same side of L. That's not true if ...



Top 50 recent answers are included