[gdal-dev] Dataset setProjection() method sets PROJCS to "unnamed"

Even Rouault even.rouault at spatialys.com
Tue Feb 10 03:36:25 PST 2015


Le mardi 10 février 2015 12:10:14, Rebo Ghecin a écrit :
> Hi,
> 
> I want to change my Dataset's projection but I have a trouble with it.

Rebo,

you didn't specify which format your dataset is. Depending on format 
capabilities, only parts of the original WKT can be preserved. There's likely 
not much you can do about that.

Even

> 
> I have custom projection like below:
> 
> PROJCS["UTM3 Degree ITRF96 DOM39",
>   GEOGCS["GCS_ITRF_1996",
>     DATUM["D_ITRF_1996",
>       SPHEROID["GRS_1980", 6378137.0, 298.257222101]],
>     PRIMEM["Greenwich", 0.0],
>     UNIT["degree", 0.017453292519943295],
>     AXIS["Longitude", EAST],
>     AXIS["Latitude", NORTH]],
>   PROJECTION["Transverse_Mercator"],
>   PARAMETER["central_meridian", 39.0],
>   PARAMETER["latitude_of_origin", 0.0],
>   PARAMETER["scale_factor", 1.0],
>   PARAMETER["false_easting", 500000.0],
>   PARAMETER["false_northing", 0.0],
>   UNIT["m", 1.0],
>   AXIS["x", EAST],
>   AXIS["y", NORTH],
>   AUTHORITY["EPSG","10103390"]]
> 
> and this is how I changed it:
> 
> String test = "PROJCS[\"UTM3 Degree ITRF96 DOM39\",
> GEOGCS[\"GCS_ITRF_1996\",     DATUM[\"D_ITRF_1996\",
> SPHEROID[\"GRS_1980\", 6378137.0, 298.257222101]],
> PRIMEM[\"Greenwich\", 0.0],    UNIT[\"degree\", 0.017453292519943295],
>  AXIS[\"Longitude\", EAST],    AXIS[\"Latitude\", NORTH]],
>  PROJECTION[\"Transverse_Mercator\"],  PARAMETER[\"central_meridian\",
> 39.0],  PARAMETER[\"latitude_of_origin\", 0.0],
>  PARAMETER[\"scale_factor\", 1.0],  PARAMETER[\"false_easting\", 500000.0],
>  PARAMETER[\"false_northing\", 0.0],  UNIT[\"m\", 1.0],  AXIS[\"x\", EAST],
>  AXIS[\"y\", NORTH],  AUTHORITY[\"EPSG\",\"10103390\"]]";
> 
> SpatialReference oSRS = new SpatialReference();
> oSRS.ImportFromWkt(test);
> inputDataset.SetProjection(oSRS.ExportToWkt());
> 
> and it returns
> 
> PROJCS["unnamed",
>   GEOGCS["GCS Name = GCS_ITRF_1996",
>     DATUM["Datum = D_ITRF_1996",
>       SPHEROID["Ellipsoid = GRS_1980", 6378137.0, 298.257222101]],
>     PRIMEM["Greenwich", 0.0],
>     UNIT["degree", 0.017453292519943295],
>     AXIS["Geodetic longitude", EAST],
>     AXIS["Geodetic latitude", NORTH]],
>   PROJECTION["Transverse_Mercator"],
>   PARAMETER["central_meridian", 39.0],
>   PARAMETER["latitude_of_origin", 0.0],
>   PARAMETER["scale_factor", 1.0],
>   PARAMETER["false_easting", 500000.0],
>   PARAMETER["false_northing", 0.0],
>   UNIT["m", 1.0],
>   AXIS["Easting", EAST],
>   AXIS["Northing", NORTH]]
> 
> I have created custom.wkt file and include it in epsg.wkt at "gdal_data"
> folder but this is also not working for me.
> 
> custom.wkt content:
> 
> 10103390,PROJCS["UTM3 Derece ITRF96
> DOM39",GEOGCS["GCS_ITRF_1996",DATUM["D_ITRF_1996",SPHEROID["GRS_1980",63781
> 37.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.01745329251994
> 33]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],
> PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",39.0],PARAMETE
> R["Scale_Factor",1.0],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]
> , AUTHORITY["EPSG","10103390"]]
> 
> Also I tried to set PROJCS like this
> 
> oSRS.SetProjCS("My Proj"); but didn't work.
> 
> Any idea with this?
> 
> Thanks
> Rebo

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list