Geographic Information Systems Asked by zsoooc on January 31, 2021
I have a PostGIS polygon which has to be extended using two points like on the picture:
My original polygon is: POLYGON((10 20,10 10,20 10,20 20,10 20))
The points I would like to extend the polygon with: POINT ( 20 30 )
and POINT ( 10 30 )
It’s very important that I would like to insert the Point2 as the first and the last point of the polygon. The Points1 should be in the last but one position. So the position of the new points is crucial.
What do you think, what is the best method to do this? Any suggestions?
UPDATE: I’ve find a solution, it works, but a little bit complicated:
SELECT ST_MakePolygon(ST_AddPoint(ST_AddPoint(ST_AddPoint(ST_RemovePoint(ST_ExteriorRing( ST_GeomFromText('POLYGON((10 20,10 10,20 10,20 20,10 20))')),
ST_NPoints(ST_GeomFromText('POLYGON((10 20,10 10,20 10,20 20,10 20))'))-1),ST_MakePoint(20,30)),ST_MakePoint(10,30),0),
ST_MakePoint(10,30)));
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP