# Splitting Streets to Create Polygons?

I have a need to take all the streets belonging to a certain area (in OpenStreetMap) and split each street by each other and form polygons from the segments that result from the split operation. I do not know whether such a function exists in the GIS tools that are available or if the algorithm needs to be written.

If I should write the algorithm, what would be a good way to approach the problem?

If the street network looks like below, polygons like given in red needs to be created (only as an example, in fact all the intersections between streets should produce polygons like these)

There is ST_Node & ST_Polygonize, which should do what you need:

SELECT (ST_Dump(ST_Polygonize(ST_Node(multi_geom)))).geom
FROM   (
SELECT ST_Collect(<geom>) AS multi_geom
FROM   <your_table>
-- WHERE <condition>
-- GROUP BY <attribute>
) q
;

You might want to use a filter and/or grouping attribute to put a limit on the amount of edges to process.

There's no guarantee ST_Polygonize will create all polygons you want, or leaves out those you don't expect, so validate the result.

• Tried this and it works. Only thing that I replaced was ST_Collect with St_Union. Got an error every time I tried to use ST_Collect – c00der Aug 19 '19 at 19:54
• Do you think you can answer this related question: gis.stackexchange.com/questions/335967/… – c00der Sep 16 '19 at 1:37

Here's an alternative to splitting the streets at their intersections and converting them into polygons. I don't know if this method is better, but I do think it's interesting to consider different ways of approaching a problem.

Basically, we create a large polygon, and use the streets to split up that polygon.

1. Create a large "background" polygon, eg using a convex hull algorithm.
2. Use the streets layer to split the background polygon.

• Any streets that don't intersect the polygon boundary twice won't split the large polygon. But once the large polygon is partially split up, some of these streets will intersect the boundaries of the smaller polygons.
3. Iterate the splitting step until none of the polygons have lines that cross over their interior.

You can see with my test data there are a few blocks that will never be split out of the background polygon. That's because those streets don't intersect the convex hull.

• This problem would be solved by starting with a tighter-fitting background polygon.
• This problem might not arise with real-world data, because a layer of streets for an administrative area usually extends outside the area boundary.

If you need to create blocks based on street intersection, then you can run the intersect tool in ArcMap and set the output type as point. this will give you the points of each intersection.

however, by using streets to create polygons, you can set a buffer around the streets between 30-40ft and dissolve by name of street. This will give you polygons of each street. If you want to take it further, you can erase the buffered streets out of a parcels layer which will hopefully give you a tax map cartographic perception of how wide the street is.

Add the points of intersection back on to your map to see where the buffered streets change name or intersect.