[postgis-users] Slivers -- eliminating programmatically

Webb Sprague webb.sprague at gmail.com
Sat Mar 17 13:06:15 PDT 2007


Josh,

> Seems to me that if the centroid of the district is always reliably
> within the county, then for the purposes of just finding out which
> districts are in which counties, your current query (centroid/poly) is
> fine - and faster than a within() with two polygons.

Yes, clipping is just necessary for future database cleaning.

> Without going to the trouble of actually coming up with sql, ways to
> programmatically 'clip' your districts seem to depend a little on some
> assumptions.  Assuming once clipped, that inside the correct county
> there's just one contiguous polygon for the district, then one method
> might be to select the intersection of the poly tables, and then simply
> select the largest polygon for each district from the result....

I will think on it.  It seems possible, but slightly dangerous with
the alternation of gaps (district too small) and overlaps (district
too big).  Also, I am afraid that I will introduce gaps and overlaps
near the vertex where two districts meet a county line.

Thx

W


>
>   -Josh
>
>
> Webb Sprague wrote:
> > Hi all,
> >
> > We have a counties shapefile and a state wide school districts
> > shapefile that we have imported.  Each of these is internally
> > consistent (no slivers or gaps) but there are slivers and gaps where a
> > school district should coincide with a county boundary.  We would like
> > to adjust the school district boundaries to fit the county whenever
> > they line up.  We assume the county boundaries are the right ones and
> > we can just clobber the district boundaries.  Note that many school
> > districts will have boundaries that only partially align with the
> > county boundary, but then turn inward; we need to keep the internal
> > boundaries the same.
> >
> > Has anybody done this programmatically before?  Or can someone point
> > me to a discussion? I googled a little, but I couldn't find anything
> > (at least easily)
> >
> > Right now, if we want to find "what districts are in county X" we do
> > something like:
> >
> > blah blah WHERE within (centroid(district.the_geom), counties.the_geom)
> >
> > because a within() or overlaps() on the two sets of polygons will get
> > messed up from the slivers and gaps issue.
> >
> > I assume that whatever solution will still need to be checked, because
> > we probably need to use a tolerance parameter in the alignment
> > algorithm.
> >
> > If necessary, I will come up with a tractable example tommorrow.
> >
> > Thanks
> > 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
>


-- 
---
On the mountains of truth you can never climb in vain: either you will
reach a point higher up today, or you will be training your powers so
that you will be able to climb higher tomorrow.
Friedrich Nietzsche

When marrying, ask yourself this question: Do you believe that you
will be able to converse well with this person into your old age?
Everything else in marriage is transitory.
Friedrich Nietzsche



More information about the postgis-users mailing list