How to do polygon intersection with LineString in PostGIS?
When I ran ST_AsText (ST_Intersection (myLinestring,myPolygon)) I saw that the result is rather a collection of many individual points which lie inside the polygon AND the linestring, but they ARE NOT the samples from my table. How do I do this right?
Why do linestrings go in and out of polygons?
Because the linestring goes in and out of the polygon multiple times I expect the intersection will be GEOMETRYCOLLECTION of multiple LINESTRINGs (which correspond to the individual continuous components of the path inside my polygon).
How to create a polygon from a set of lines?
What this means, is that all of the linestrings are combined in all possible combinations, so as to make up the equivalent to the exterior ring of a polygon. Whereas, if you attempt to ST_Polygonize a set of LineStrings, none of which on it’s own describes a polygon, you simply get the LineStrings back.
When to skip the St _ intersection call in PostGIS?
In many situations you know the intersection of 2 geometries without actually computing an intersection. In these cases, you can skip the costly ST_Intersection call. Cases like this: This kind of question comes up a lot: As discussed in stackexchange Acquiring ArcGIS speed in PostGIS
Can a polygon be created from a LineString?
I created a LINESTRING from them ordered from the oldest to newest. I also have a POLYGON and I would like to determine the subset of my LINESTRING which lies inside my polygon. This subset should be only the points from the table – no interpolated points from the linestring. All my geometries have SRID 4326.
How to check the number of components inside a polygon?
As a quick check to determine the number of components inside I ran: ST_NumGeometries (ST_Intersection (myLinestring,myPolygon)) but I got some really big number which actually exceeds even the number of coordinates in my table.