[postgis-users] Re: shp2pgsql bug [PATCH]

strk strk at freek.keybit.net
Wed Jun 18 02:16:14 PDT 2003


Ok. for (( problem 2 )) It seems that invalid geometries where in
the shapefile (as far as shapelib let shp2pgsql know).
LINEZ objects with less then 2 vertices. I've patched shp2pgsql
to recognized such an inconsistence and use a NULL geometry for
that record printing a warning on stderr. Contestually I've found
another two bugs in LINEZ handling having to do with dump_format:
SRID information was missing and also a <tab>

Patch is here:
http://cobalt.rmnet.it/~san/postgis/shp2pgsql-cvs20030515-linez.patch

For (( problem 1 )) I still don't know... it seems that the whole
record is empty, I could make shp2pgsql set geometry to NULL, but
would probably be better to skip the whole record since no other
information is contained... 

--strk;

strk wrote:
> Hello... yet another shp2pgsql problem here !
> 
> (( problem 1 ))
> 
> >From a shapefile imported with shp2pgsql I get an extra EMPTY geometry.
> This is the last INSERT from generated sql:
> 
> 	insert into "rfi2_14" values('174','0','0','0','0','0.000',
> 	NULL,NULL,NULL,NULL,NULL,
> 	GeometryFromText('MULTILINESTRING ()',30001) );
> 
> It looks like a NULL entry, no dbf data, no geometry... 
> The postgis parser does not like 'MULTILINESTRING ()'
> "couldn't parse geometry"
> 
> Shouldn't shp2pgsql check for these exceptions storing a NULL
> geometry instead, and maybe printing a warning  on stderr ?
> 
> I'm not considering also the possibility that this last record was not
> in the shapefile at all.
> 
> (( problem 2 ))
> 
> >From a shapefile imported with shp2pgsql I get some MULTILINESTRING
> geometries which has someting missed at the beginning of definition:
> 
> 	GeometryFromText(
> 	'MULTILINESTRING (,686443.612958726 150851.536125343 0 ))',
> 	30001)
> 
> Getting this problem makes me think that probably problem 1 is also
> just shp2pgsql related, might be a bogus multilinestring handling.
> 
> *****
> 
> any hint on catching the bug ?
> 
> --strk;
> 
> _______________________________________________
> 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