[Gdal-dev] Ogr2ogr shapefile to postgis precision problem
Asger Petersen
asger at jo-informatik.dk
Mon Mar 14 09:35:13 EST 2005
Hi
I'm having some problems regarding attribute integer precision when
converting shapefiles to postgis tables.
I have a column named ("ID") which ArcGIS reports as "double(15,0)", and
it holds only positive integers with 15 digits (like: 12080000240330).
Ogr2ogr maps this column to "numeric(15)" in postgres, but the values it
actually puts into the table are negative and only 10 digits (like:
-1742763318).
I have tried using the precision=no, but this means that the column is
mapped into "int(4)" with the exact same values as before.
Using ogrInfo on the shapefile shows:
---
C:\...>ogrinfo -so jc.shp jc
INFO: Open of `jc.shp'
using driver `ESRI Shapefile' successful.
Layer name: jc
Geometry: Point
Feature Count: 32613
Extent: (677586.199764, 6179614.699984) - (725471.903228,
6225290.304144)
Layer SRS WKT:
PROJCS["ETRS_1989_UTM_Zone_32N",
GEOGCS["GCS_ETRS_1989",
DATUM["ETRS_1989",
SPHEROID["GRS_1980",6378137.0,298.257222101]],
PRIMEM["Greenwich",0.0],
UNIT["Degree",0.0174532925199433]],
PROJECTION["Transverse_Mercator"],
PARAMETER["False_Easting",500000.0],
PARAMETER["False_Northing",0.0],
PARAMETER["Central_Meridian",9.0],
PARAMETER["Scale_Factor",0.9996],
PARAMETER["Latitude_Of_Origin",0.0],
UNIT["Meter",1.0]]
ID: Integer (15.0)
FEATTYP: Integer (4.0)
JNCTTYP: Integer (1.0)
ELEV: Integer (2.0)
---
Using ogrinfo to list the features shows:
---
OGRFeature(dnk20_________jc):192
ID (Integer) = -1542382448
FEATTYP (Integer) = 4120
JNCTTYP (Integer) = 0
ELEV (Integer) = 0
POINT (693229.167 6217966.344)
---
Can anyone tell me what I am doing wrong, and how to get these values
correctly into postgres?
Thanks in advance, and a good day to everyone
Asger Petersen
More information about the Gdal-dev
mailing list