0

This question already has an answer here:

I'm looking to convert Park polygons from OSM into points.

The QGIS fTools Extract Nodes tool will convert a polygon to points at the vertices.

What is the equivalent function or work-flow in PostGIS?

enter image description here

marked as duplicate by Chris W, PolyGeo Feb 22 '15 at 21:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • I will confess that the other question goes a step further to get coordinates, and not just using st_dump to get the points, so my flag of duplicate may have been a bit hasty. I apologize if you consider this to be significantly different to not warrant marking as a duplicate. – Chris W Feb 22 '15 at 21:08
4

Yo can use ST_DumpPoints(geom) to get the points listed.

Look at the example how to use it.

The result contains both the geometry and a path telling where in the polygon the point belongs. So to just get the geometry (points) do like this:

SELECT (ST_DumpPoints(the_geom)).geom
  • I'm struggling with visualizing this result - any thoughts? Is that what 'i' is? – DPSSpatial Feb 24 '15 at 4:54
  • mapBaker -- what are you using for visualizing. Not sure what Nicklas meant by i. There is a path property which is an array of integers defining depth in geometry. You should be able to visualize this in QGIS DbManager with - SELECT (g).path[1], (g).geom FROM (SELECT ST_DumpPoints(geom) As g FROM sometable) As f; – LR1234567 Feb 24 '15 at 6:41
  • Just a typo. It should have been "it" :-) – Nicklas Avén Feb 24 '15 at 6:51
  • @LR1234567 I can only get PATH values of '1' for that query. I am getting back the correct number of nodes, so for now, I'll say I need to work on my workflow for how to use these points... Thank you both! – DPSSpatial Feb 24 '15 at 17:12
  • If you have polygons/multipolygs path[1] is the index of the polygon the point belongs to. Not interesting unless you have a multipolygon. path[2] would be the ring . path[3] would be the index position of the point in the ring. So I'm guessing maybe what you want is path[3] – LR1234567 Feb 24 '15 at 21:06

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