Reputation: 6573
I have a WKT linestring and I want to use it to search for intersections in postgis but the linestring has some level of error and won't perfectly intersect the things stored in postgis so I want to convert it to a polygon and give it n
meters thickness so that it will intersect with things next to it.
An example of what I want to do. Green being the polygon created from the line
The language of the solution doesn't matter too much. I can adapt the solution to work so I am just looking for some general algorithm which can create the polygon. The linestring contains geographical coords so I think working out how far away n
meters is could be difficult.
I think the best way to go about this is drawing normals off the linestring and marking the point that's far enough away
Upvotes: 1
Views: 1339
Reputation: 6573
Looks like this can be done with postgis. http://www.postgis.org/docs/ST_Buffer.html
SELECT ST_Buffer(
ST_GeomFromText(
'LINESTRING(50 50,150 150,150 50)'
), 10, 'endcap=round join=round');
Upvotes: 1