[postgis-users] Slivers -- eliminating programmatically

Josh Livni josh at livniconsulting.com
Sat Mar 17 23:18:32 PDT 2007


Webb,

I probably didn't explain myself very well, but I don't see how that 
method could introduce gaps or overlaps:  All it will do is remove 
overlapping 'slivers'.

What it won't do is 'grow' your district to match a county boundary in 
the case where there is a 'gap' between the district and boundary.

In any case, if simply getting rid of slivers, where a sliver is defined 
as that part of a district that overlaps a county that district is not 
supposed to be located in, then I think the general method I mentioned 
do the trick.

Anyway, I imagine the clipping thing I think you were describing you 
wanted is probably a common scenario - others may have a superior or 
more clear explanation and method to solve it.

  -Josh

Webb Sprague wrote:
> 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
>>
>
>