[gdal-dev] Problem re-projecting shapefile by using ogr2ogr

deb otrov at hush.ai
Wed Dec 12 16:21:27 PST 2012


Hi,

I want to re-project shapefile from current projection (whatever that is) to ESPG:4326.
My example layer (misc.shp) is in EPSG:31227:

    > ogrinfo -al -so misc.shp
    INFO: Open of `misc.shp'
          using driver `ESRI Shapefile' successful.
    
    Layer name: misc
    Geometry: Line String
    Feature Count: 10
    Extent: (21.267388, 42.015857) - (21.270225, 42.017470)
    Layer SRS WKT:
    PROJCS["MGI_Balkans_zone_7_deprecated",
        GEOGCS["GCS_MGI",
            DATUM["Militar_Geographische_Institute",
                SPHEROID["Bessel_1841",6377397.155,299.1528128]],
            PRIMEM["Greenwich",0],
            UNIT["Degree",0.017453292519943295]],
        PROJECTION["Transverse_Mercator"],
        PARAMETER["latitude_of_origin",0],
        PARAMETER["central_meridian",21],
        PARAMETER["scale_factor",0.9999],
        PARAMETER["false_easting",7500000],
        PARAMETER["false_northing",0],
        UNIT["Meter",1]]
    id: Integer (10.0)


As suggested by couple of sources from Google search results, I used this:

    > ogr2ogr -t_srs EPSG:4326 misc_re.shp misc.shp


And then investigate metadata of newly creates vector:

    > ogrinfo -al -so misc_re.shp
    INFO: Open of `misc_re.shp'
          using driver `ESRI Shapefile' successful.
    
    Layer name: misc_re
    Geometry: Line String
    Feature Count: 10
    Extent: (-34.004490, 0.000230) - (-34.004490, 0.000230)
    Layer SRS WKT:
    GEOGCS["GCS_WGS_1984",
        DATUM["WGS_1984",
            SPHEROID["WGS_84",6378137,298.257223563]],
        PRIMEM["Greenwich",0],
        UNIT["Degree",0.017453292519943295]]
    id: Integer (10.0)


There is no projection (PROJCS) in metadata and coordinates are different from source vector.
I then tried various EPSG codes, and I get PROJCS metadata, but Extent values are totally different for each projection, so even if I assume some units issue, there can't be that different units in existence.

Can anyone give me a pointer where I did wrong?

Thanks



More information about the gdal-dev mailing list