[gdal-dev] GDALGetProjectionRef(...) problem on filetype JPEG and BMP

Daniele Romagnoli daniele.romagnoli at geo-solutions.it
Thu Sep 17 08:26:34 EDT 2009


Hi Alex,
How your TIF and BMP files are generated?
Are you writing them by yourself from an input image?
In that case, make sure to create a samenamefile.jpg.aux.xml file containing
a <PAMDataset> tag with the <SRS> definition on it.
Try using gdal_translate -of JPEG mytiff.tif myjpeg.jpg to see how that
aux.xml should be formed.

Regards,
Daniele


2009/9/17 alex <sharukan at mail.ru>

>  Good day.
>  I encountered the following problem using GDAL. GDALGetProjectionRef(...)
> works with file formats TIF, but JPG and BMP returns an empty string.
>
>  Used as:
>  There have been downloaded sources from
> http://download.osgeo.org/gdal/gdal162.zip
> Sources was built using Visual Studio 2005, the utility nmake, using the
> command line interface.
>  Then was opened raster map file with format MapInfo by my program. MapInfo
> file was created by using the export map function of the MapInfo program.
>
>  I used the C API library GDAL. In the body of the program:
>
> GDALDatasetH pDataset = GDALOpen("map_filename", GA_ReadOnly);
>
>  and
>
> GDALGetGeoTransform(...) and GDALRasterIO(...)
>
>  Then I opened the map file and exported part of it to coordinatesof I
> needed.
>  It worked with the map file format map_filename.tif + map_filename.tab,
> map_filename.jpg + map_filename.tab,map_filename.bmp + map_filename.tab.
>
>  Then I could to get access to the map coordinates in the format .TIF using
> the function:
>
> GDALGetProjectionRef(pDataset)
>
>  which returned the projection maps of the form <wkt format projection
> string>, as was intended.
>
>  But when opening files type .JPG and .BMP
>
> GDALGetProjectionRef (pDataset)
>
>  returns an empty string "".
>  I think that the library is somehow obtains a coordinate system maps,
> because
> GDALGetGeoTransform (...) work.
>
>  Please specify how i can get a system of map coordinates for these files
> are JPG and BMP and import it into an object of class OGRSpatialReference.
>
>  I apologize for my poor language skills.
>  Thank you.
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
-------------------------------------------------------
Eng. Daniele Romagnoli
Software Engineer

GeoSolutions S.A.S.
Via Carignoni 51
55041 Camaiore (LU)
Italy

phone: +39 0584983027
fax:     +39 0584983027
mob:   +39 328 0559267


http://www.geo-solutions.it

-------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20090917/868540b3/attachment.html


More information about the gdal-dev mailing list