[gdal-dev] WKT to proj.4 - I'm complete lost!
Mateusz Loskot
mateusz at loskot.net
Thu Sep 10 15:48:46 EDT 2009
José Roberto Pereira Jr. wrote:
> Hi list!
>
> I'm a newbie in geoprocessing and I need to transform a WKT
> representation to a proj.4. I found a example using proj utility:
>
> +proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0
> +k=1.0 +units=m +nadgrids=@null +wktext +no_defs
>
> but I don't understand nothing about! Someone could tell me some
> resource or help me for translate the following WKT to proj.4?
You may try to use OGRSpatialReference
http://gdal.org/ogr/classOGRSpatialReference.html
Pseudo-code that should be easy to replace with C++, C or Python is:
OGRSpatialReference sr;
char const* proj4 = "...";
sr.importFromProj4(proj4);
char* wkt = 0;
sr.exportToWkt(&wkt); // allocates string and puts WKT into it
// access WKT string using wkt pointer
CPLFree(wkt);
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
More information about the gdal-dev
mailing list