[postgis-users] How to create block polygons from street network?

Van Bakergem, William vanbakergemw at umsl.edu
Thu Apr 23 12:40:54 PDT 2009


Stephan,

I have a tool for generating city blocks from street center lines.  
1. Given centerlines, street widths and street names (from Google Maps), calculate intersections, blocks and block sides;
2. All geometries are inserted into PostGIS tables;
3. From these table I can generate a virtual city based on building typologies and development histories for any year over a 200 year time interval.  
4. Display in Xj3d or Google Earth (COLLADA).

I would like to hear more about your project.

Dave van Bakergem



-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net on behalf of Stephen Woodbridge
Sent: Thu 4/23/2009 2:29 PM
To: PostGIS Users Discussion
Subject: [postgis-users] How to create block polygons from street network?
 
Hi all,

Here is an interesting problem that I could use some suggestions and/or 
sample code for. I have a street network where all the street segments 
are noded at intersections. What I need to extract is all the blocks in 
the coverage. A "block" is the smallest polygon bounded by segments that 
does not have any segment crossing it. It could have a cul-de-sac 
protruding into its interior as long as it does not divide the polygon 
in two.

I could create a node adjacency list, but I'm not sure if that helps me.

I'm thinking that each edge needs to be tagged with a right and left 
polygon id, then you can create polygons by grouping on the id.

while (current = get_edge_without_rl_pid) {
   if current.right_side_edge has no pid {
     get new_pid as this_pid
     get other edges from end
     find right most edge
     if edge has id then {
       update all new_pid to id
       mark new_pid as unused
       this_pid = id
     }
     else
       mark both edges as this_pid
   }
   if current.left_side_edge has no pid {
     get new_pid as this_pid
     get other edges from end
     find left most edge
     if edge has id then {
       update all new_pid to id
       mark new_pid as unused
       this_pid = id
     }
     else
       mark both edges as this_pid
   }
}

Does this seem like it would work?
Anyone interested in turning this into plpgsql?

It might be better to recursively pick an edge and recursively walk 
connected right most edges back onto itself marking the edges as you go. 
At some point you may still have edges not included in any of the above 
that can only be marked by walking the left most edges.

Thoughts?

-Steve W
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users

-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 4210 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20090423/5183f38e/attachment.bin>


More information about the postgis-users mailing list