I am trying to import to my Postgresql (9.1+129ubuntu1) + PostGIS (1.5.3-2) database a Shapefile with polygons with the ogr2ogr tool from Gdal-Bin package (1.7.3-6ubuntu3).
I know the origin SRS of the Shapefile (EPSG:23031), and I know the destination SRS used in the database so I can represent all the diferent objects together (EPSG:25831), so I use this command:
ogr2ogr -f "PostgreSQL" "PG:dbname=DBNAME host=127.0.0.1 user=DBUSER password=DBPASS" "/PATH_TO_SHAPEFILES/SHAPEFILE.shp" -s_srs EPSG:23031 -t_srs EPSG:25831 -lco PRECISION=NO -lco GEOM_TYPE=geometry -lco GEOMETRY_NAME=the_geom -lco EXTRACT_SCHEMA_FROM_LAYER_NAME=NO -nlt GEOMETRY -nln DBTABLENAME
And of course in the path "/PATH_TO_SHAPEFILES/" I have the files SHAPEFILE.shp, SHAPEFILE.shx, SHAPEFILE.dbf and SHAPEFILE.prj
But after the import, I try to represent that polygons and they seem moved to de East, so I guess is a projection transform problem or definition.
Here is an snapshot of the representation in the map by OpenLayers. The correct situation of the polygons should be the grey lines, and the imported polygons are the blue polygons with black lines:
EDIT: As @tilt recommended me I tried to do the same process but converting from shapefile to shapefile, with this command:
ogr2ogr -f "ESRI Shapefile" pruebashp2shp.shp "/PATH_TO_SHAPEFILES/SHAPEFILE.shp" -s_srs EPSG:23031 -t_srs EPSG:25831
I opened the result by QuantumGIS together with the original layer, and it is also moved to the East, as the following image shows:
# ED50 / UTM zone 31N <23031> +proj=utm +zone=31 +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +units=m +no_defs <>
It is not uncommon at all that some program versions have different values for +towgs84 or nothing at all. Newer versions tend to have less bugs but if the data are old they may have been created with buggy parameters and you should use the same buggy parameters for reading.