I'm currently trying to create polygons that represent the areas surrounded by roads. The roads are stored in PostGIS as points / lines so I have flexibility over what I can do with them.

I'm basically trying to turn the white areas of this example line output into polygons:

enter image description here

Any ideas?

Here is the PostGIS to achieve this (assuming you have a road table full of lines):

SELECT (ST_Dump(ST_Polygonize(roads.geom))).geom AS the_geom FROM
(SELECT ST_Transform(ST_SetSRID(geom, 27700), 4326) AS geom FROM road_lines) AS roads

4 Answers 4


Some hints:

  1. You could use the ST_Polygonize processing of PostGIS.
  2. You could have a look at this QGIS plugin (I have not tested it myself...)
  3. If you speak Java, you could use the polygoniser of JTS.
  • 1
    Thank you! ST_Polygonize did the trick. I've updated the question with the code that worked. Commented Feb 15, 2013 at 18:51

You could try creating a buffer layer of your roads, so that it is a polygon. Then create a polygon layer delineating your area of interest, and use the union tool on both polygon layers. You should be able to differentiate the polygons inside the roads (white areas) from the transportation lines from the union results.

  • I notice that qgis has a lines to polygons tool under the vector menu
    – lewis
    Commented Feb 15, 2013 at 16:53

The method would depend on the actual outcome that you would like. One thing that comes to mind is to calculate a density raster, find a threshold that represents the approximate road density that you are interested in, create a binary raster based on this threshold and turn the resulting raster into a polygon feature class. You could incorporate a multiscale assessment by varying the kernel size and integrating across multiple density estimates. You could also weight the density estimate(s) by an attribute in the road data (e.g, road class, size, ...). This would allow you to incorporate characteristics of the observed structure and allow for a "zone of influence" surrounding your linear feature class.


If you have access to ArcInfo then have a look at the geo-processing tool Feature To Polygon (Data Management)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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