6

How to convert points data to polygon, enter image description here so as to form polygon from exterior point as shown above

4

I would create a geometry collection from the points using st_collect(): http://postgis.net/docs/ST_Collect.html

Then I would create convex hull from the point collection: http://postgis.net/docs/ST_ConcaveHull.html

If you have a table of point geometries called testpoints where geometry column name was the_geom, this should create the polygon that you are looking for:

SELECT st_astext(st_concavehull(st_collect(the_geom),0.99))
  FROM myschema.testpoints;
  • If you are looking for a good PostGIS book, the new PostGIS Cookbook from PACKT is very good. – DavidF Mar 21 '14 at 18:33
  • thanks david, your query works on a simple points, but not good enough on complex points. – user28344 Mar 22 '14 at 1:59
  • Can you provide an example or define what you mean by complex points? Multi-point features? I am pretty sure that the query that I provided will correctly solve the problem that you diagrammed. – DavidF Mar 22 '14 at 18:01
  • This my point <img src="duniabimbel.com/blog/img/files/Untitled.png"> i use concavehull with 0.5 % – user28344 Mar 24 '14 at 7:53
  • I think the trick is that there is no magic solution that fits all point sets. The computer doesn't know what you want it to look like in the end. st_concave_hull starts with a convex hull and then 'shrink wraps' it based on your value for target percent. I would increase the value of your target percent. – DavidF Mar 24 '14 at 13:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.