[postgis-users] shp2pgsql fails on malformed integer attribute

Andrea Peri aperi2007 at gmail.com
Sat Aug 14 00:18:04 PDT 2010


>  aman.verma at mcgill.ca  wrote..
>If you use shp2pgsql to upload a shapefile with an attribute table that has
a malformed integer
>(like a letter), shp2pgsql will not correct it, and the upload will fail.
>Normally, I would view this as 'expected behaviour' (garbage in, garbage
out). However, I have two
>reasons to believe that shp2pgsql should do the correction:
>1) ArcGIS, and other software that read the xBase format (DBF), interpret
such malformed integers as 0.
>There seem to be a lot of shape files floating around that have malformed
integers in them, precisely
>because they appear to be working. Users may have a difficult time
understanding why shp2pgsql keeps
>trying to upload 'g' when all they can see is '0'.

I think this is not a good strategy.

If there a mistake in the dbf the mistake must be reported, not hide
resolving automatically it.
Otherwise the shapefile version became not-interoperability.
Just now often the gis user was speaken about "shapefile read from arcgis"
or some other tools, as they was difference from other kind of shapefile.

I experience many situation where a shapefile send me from other users are
wrong, and the user report me "but my tool read it so for me it is  ok."

This may be born many kinds of formats shapefiles difference each other.
So the shapefile format "became an opinion", and every tool apply they
specific changing to the format.
For example

what if a filed name was more then 10 character ?
what if a text field was more character of how much declared in the header ?
what if a date field was filled with a number ?
and so on .....

Even in your case:

if the field numeric in the shapefile instead of be fill with numbers was
filled with '1', '2', '3', etc...
where the number are however not really numbers but text based, an action of
importing always 0.
Will be more confusing. The user don't understand why a number (or
simil-number) became a '0'.

Andrea.

-- 
-----------------
Andrea Peri
. . . . . . . . .
qwerty àèìòù
-----------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20100814/093bcba9/attachment.html>


More information about the postgis-users mailing list