[postgis-users] Shared geometries?

Marc Compte mcompte at sigte.udg.es
Fri May 11 05:14:15 PDT 2007


Don't know whether this would work fine and whether this suits you but ...

- If 1 county belongs to 1 and only 1 state ...
- and if your counties have an attribute field identifying that state ...

Would it be an acceptable workaround for the topology problem to have 
only the county table with geometry then have a state table without 
geometry which draws it from a geomunion of the county table (grouping 
by counties.state)?

I'm thinking about something like:

CREATE TABLE states (
    id serial,
    [attributes]
);

CREATE TABLE counties (
    id serial,
    state int4,
    the_geom geometry
);

SELECT geomunion(counties.the_geom) AS states_geom FROM counties, states 
WHERE counties.state=states.id GROUP BY counties.state;

I guess this would be quite resource comsuming, though.

If you need to do this too often you may want to create the geom field 
in states and have a trigger update that table every time 
states.the_geom is updated.

I may be wrong though, never tried this myself.

Marc

En/na Jeff Dege ha escrit:
> 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?
>
> _______________________________________________
> 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