<p>Hi Frank & List<br />
<br />
I tested the program below but it does not out put the .tab or
.mif/.mid with the coordinate system. It is always non-earth.
Could you please check it against your gdal/ogr installation to see
if something went wrong during my compilation of gdal 1.6.2?<br
/>
<br />
Thanks a lot,<br />
<br />
Reinaldo<br />
<br />
*******************************<br />
#include "gdal.h"<br />
#include "ogr_spatialref.h"<br />
#include "ogrsf_frmts.h"<br />
#include "stdio.h"</p>
<p>double Lat[3], Lon[3];<br />
int n=0; char *pszWKT = NULL;</p>
<p>void main()<br />
{<br />
OGRSpatialReference oSRS;<br />
// oSRS.SetWellKnownGeogCS( "EPSG:4326" );<br />
oSRS.importFromMICoordSys( "CoordSys Earth Projection 1,
104" );</p>
<p> const char *pszDriverName = "MapInfo File" ;</p>
<p> OGRSFDriver *poDriver;<br />
OGRRegisterAll();</p>
<p> poDriver =
OGRSFDriverRegistrar::GetRegistrar()->GetDriverByName(<br />
pszDriverName );<br />
if( poDriver == NULL )<br />
{<br />
printf( "%s driver not
available.\n", pszDriverName );<br />
exit( 1 );<br />
}</p>
<p> OGRDataSource *poDS;<br />
poDS = poDriver->CreateDataSource( "c:/test01.mif",
NULL );<br />
// poDS = poDriver->CreateDataSource( "c:/test01.tab",
NULL );<br />
if( poDS == NULL )<br />
{<br />
printf( "Creation of
output file failed.\n" );<br />
exit( 1 );<br />
}</p>
<p> OGRLayer *poLayer;<br />
poLayer = poDS->CreateLayer( "test01",
NULL, wkbPoint, NULL );<br />
if( poLayer == NULL )<br />
{<br />
printf( "Layer creation
failed.\n" );<br />
exit( 1 );<br />
}</p>
<p> OGRFieldDefn oField0( "NAME1", OFTString );<br />
OGRFieldDefn oField1( "NAME2", OFTString );</p>
<p> oField0.SetWidth(32);<br />
oField1.SetWidth(32);</p>
<p> if( poLayer->CreateField( &oField0 ) != OGRERR_NONE )<br />
{<br />
printf( "Creating Name
field failed.\n" );<br />
exit( 1 );<br />
}</p>
<p> if( poLayer->CreateField( &oField1 ) != OGRERR_NONE )<br />
{<br />
printf( "Creating Name
field failed.\n" );<br />
exit( 1 );<br />
}<br />
<br />
*******************************<br />
.mif output:<br />
<br />
Version 300<br />
Charset "Neutral"<br />
Delimiter ","<br />
Columns 2<br />
NAME1 Char(32)<br />
NAME2 Char(32)<br />
Data</p>
<p>Point -45.13975272 -22.69426671<br />
Symbol (35,0,12)<br />
Point -45.86066928 -23.21117775<br />
Symbol (35,0,12)<br />
Point -44.33023872 -22.68505859375<br />
Symbol (35,0,12)<br />
<br />
************************************<br />
.mid output:<br />
<br />
"TEST01","TEST02"<br />
"TEST01","TEST02"<br />
"TEST01","TEST02"<br />
<br />
>> Reinaldo escada Chohfi wrote: <br />
> <br />
>>> Hello List, <br />
> <br />
>>> <br />
> <br />
>>> I am still trying to get a x,y (lon/Lat) point file in
MapInfo <br />
> format <br />
> <br />
>>> with <br />
> <br />
>>> coordinate information. <br />
> <br />
>>> <br />
> <br />
>>> I get the correct MapInfo files out (.tab or .mif) with the
x,y <br />
> points <br />
> <br />
>>> and <br />
> <br />
>>> attributes, but without the CoordSys information. <br />
> <br />
>>> The output file is always Non-Earth. <br />
> <br />
>>> <br />
> <br />
>>> I've tried everything: <br />
> <br />
>>> <br />
> <br />
>>> OGRSpatialReference oSRS; <br />
> <br />
>>> oSRS.SetWellKnownGeogCS("EPSG:4326"); <br />
> <br />
>>> oSRS.importFromMICoordSys( "CoordSys Earth Projection 1,
<br />
> 104" ); <br />
> <br />
>>> <br />
> <br />
>>> <br />
> <br />
>>> Could someone PLEASE let me know what to do? <br />
> <br />
>> <br />
> <br />
>> Reinaldo, <br />
> <br />
>> <br />
> <br />
>> I just tried: <br />
> <br />
>> <br />
> <br />
>> ogr2ogr -skipfailures -f "MapInfo File" out.mif <br />
> GB4X0000.000 TUNNEL <br />
> <br />
>> <br />
> <br />
>> and this produced a mapinfo mid/mif fileset with "CoordSys
Earth <br />
> <br />
> <br />
>> Projection 1, 104" as the coord sys line. I also tested a
small <br />
> <br />
> <br />
>> program: <br />
> <br />
>> <br />
> <br />
>> <br />
> <br />
>> #include "gdal.h" <br />
> <br />
>> #include "ogr_spatialref.h" <br />
> <br />
>> <br />
> <br />
>> int main() <br />
> <br />
>> <br />
> <br />
>> { <br />
> <br />
>> OGRSpatialReference oSRS; <br />
> <br />
>> <br />
> <br />
>> oSRS.importFromMICoordSys( "CoordSys Earth Projection 1, <br />
> 104" ); <br />
> <br />
>> } <br />
> <br />
>> <br />
> <br />
>> and it appeared to correctly parse the Coordsys into a WGS84 srs.
<br />
> <br />
>> <br />
> <br />
>> I even tried: <br />
> <br />
>> <br />
> <br />
>> ogr2ogr -a_srs wgs84.wkt -skipfailures -f "MapInfo
File" <br />
> out.mif <br />
> <br />
>> data/s57/GB4X0000.000 TUNNEL <br />
> <br />
>> <br />
> <br />
>> with wgs84.wkt holding: <br />
> <br />
>> <br />
> <br />
>> <br />
>
GEOGCS["unnamed",DATUM["WGS_1984",SPHEROID["WGS
<br />
> <br />
> <br />
>> <br />
>
84",6378137,298.257223563],TOWGS84[0,0,0,-0,-0,-0,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]
<br />
> <br />
> <br />
>> <br />
> <br />
>> and things seemed to work. <br />
> <br />
>> <br />
> <br />
>> Can you provide a more complete example that is failing for you?
<br />
> <br />
>> <br />
> <br />
>> Best regards, <br />
> <br />
>> -- <br />
> <br />
>> <br />
>
---------------------------------------+--------------------------------------
<br />
> <br />
> <br />
>> I set the clouds in motion - turn up | Frank Warmerdam, <br />
> <br />
>> warmerdam@pobox.com <br />
> <br />
>> light and sound - activate the windows |
http://pobox.com/~warmerdam <br />
> <br />
> <br />
>> and watch the world go round - Rush | Geospatial Programmer for
Rent <br />
> <br />
> <br />
>> <br />
> <br />
>> <br />
> <br />
> <br />
> <br />
</p>