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

strk strk at freek.keybit.net
Wed Jun 18 02:46:09 PDT 2003


I've updated the patch to also handle invalid line and linem shapes:

http://cobalt.rmnet.it/~san/postgis/shp2pgsql-cvs20030515-line.patch

NOTE that it is ...-line.patch not ...-linez.patch as before.

For (( problem 1 )) the result is a 'fake' record with all NULL
attributes and a NULL geometry. The problem might be handled 
completely skipping the record but I don't know how to check for
a completely empty dbf record. Frank? Moreover this problem occurred
at the last record, might it be a wrong record count?

--strk;


strk wrote:
> 
> 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
> 
> _______________________________________________
> 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