[Gdal-dev] No CoordSys line in exported Mif file
Frank Warmerdam
warmerdam at pobox.com
Thu Mar 22 12:04:19 EDT 2007
Joerg Schwerdt wrote:
> Hi,
>
> my name is Joerg and I have no experience using GDAL/OGR.
>
> I wrote a program that creates mif/mid files using the ogr_api.h functions.
> Everything is working fine
> except that there is no CoordSys line in the header of the mif file.
> Unfortunately the MapInfo program
> can't read that mif-file.
>
> What can I do to tell OGR to create this line? (I'm using the C interface -
> ogr_api.h)
Joerg,
You should be able to pass an OGRSpatialReferenceH to OGR_DS_CreateLayer()
containing your coordinate system, and then OGR/MITAB will write out a
corresponding CoordSys line in the file.
You could create a WGS84 coordinate system object like this:
OGRSpatialReferenceH hSRS;
hSRS = OSRNewSpatialReference(NULL);
OSRSetFromUserInput( hSRS, "WGS84" );
... create layer ...
OSRDestroySpatialReference( hSRS );
Note that you will need to include ogr_srs_api.h. You might also find the
following tutorial instructive, though it is focused on the C++ version of
the API:
http://www.gdal.org/ogr/osr_tutorial.html
Best regards,
--
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush | President OSGeo, http://osgeo.org
More information about the Gdal-dev
mailing list