[postgis-users] Shared geometries?

Brent Wood pcreso at pcreso.com
Fri May 11 13:24:17 PDT 2007


As mentioned in other replies, this requires a topological model which, unless
I'm missing something, is feasible now with PostGIS, as described below.


> Suppose I have a shapefile containing county data, with polygon
> geometries representing the county boundaries.  And another shapefile
> containing state data, with polygon geometries representing the state
> boundaries.
>
> The state boundaries and the county boundaries should coincide, though I
> know of no way of enforcing that with shapefiles.
>
> Is there a way, in PostGIS, to create two layers that have different
> sets of attributes, but whose gemoetries share the same points?  So that
> if I edit the county boundaries, the state boundaries will automatically
> reflect those changes?

 
If you can generate the constituent linework required to define the polygons,
you could (theoretically anyway) have a table of unique lines, then tables
identifying the lines for each county & state, & build the polygons from the
lines as required. This would pretty much be an implementation of a topological
model. Edit the underlying lines & all dependent polygons are automatically
updated.

Perhaps instantiate the polygons as views on the lines table....


t_lines ---< t_county_line >--- t_county

line_id      line_id            county_id
line         county_id          name
...                             ... 

        ---< t_state_line >--- t_state
             
             line_id            state_id
             state_id           name
                                ...


Then a view polygonising the lines for each county, or if you prefer, maybe a
cron job or trigger to build a table with the polygons every day or on a change
to the lines.

I guess the hardest part would be generating the initial linestrings.


Cheers

  Brent Wood 




More information about the postgis-users mailing list