[postgis-users] Slivers -- eliminating programmatically

Josh Livni josh at livniconsulting.com
Sat Mar 17 11:37:12 PDT 2007


Webb,

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.

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....

  -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





More information about the postgis-users mailing list