[postgis-users] How to create block polygons from street network?
Stephen Woodbridge
woodbri at swoodbridge.com
Thu Apr 23 13:35:25 PDT 2009
Hi Dave,
I have a client that is interested in getting polygon blocks from a road
network. I'm not sure what for but it seemed like something that should
not be that hard to do given noded street data. I have used pgRouting so
I know I can build a good adjacency graph of the data. The problem with
an adjacency graph is that it does not tell you which node is right/left
most so you have to do some analysis of the geometry unless there is
some nifty graph analysis the finds all polygons in a graph.
How does your tool work?
Are you will to share it?
I was thinking that such tools might be a useful add-on to postgis.
-Steve
Van Bakergem, William wrote:
> 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
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
More information about the postgis-users
mailing list