[postgis-devel] Re: PostGIS / SHP loader: inner rings discarded

Sandro Santilli strk at refractions.net
Mon Mar 14 13:47:54 PST 2005


Thank you LASZLO, committed.
--strk;

On Mon, Mar 14, 2005 at 10:06:07PM +0100, LASZLO Istvan wrote:
> 
> Dear Developers,
> 
> It seems that I have found a small bug in shp2pgsql.c. It causes 
> that only the first inner rings of polygons are loaded. (Sorry 
> if already known.)
> 
> As far as I can see, changing of 'break;' to 'continue;' in line 
> 982 of shp2pgsql.c (both RC3 and current CVS version) solves the 
> problem.
> 
> if ( outer )
> {
> 	outer->linked++;
> 	while(outer->next) outer = outer->next;
> 	outer->next = inner;
> 	break; // should be: continue;
> }
> 
> If an inner ring is found within an outer one, 'break;' exits 
> from the whole loop enumerating inner rings. However, 
> 'continue;' skips only the reporting of an 'orphan hole', which 
> is probably the intended behaviour.
> 
> I have tested it on several complex cases, the result looks much 
> better. :-)
> 
> Best regards,
> Istvan
> 
> --
> Istvan LASZLO
> 
> Institute of Geodesy, Cartography and Remote Sensing (FOMI)
> Budapest, Hungary



More information about the postgis-devel mailing list