Changeset 13869

Show
Ignore:
Timestamp:
02/23/08 17:36:51 (4 months ago)
Author:
rouault
Message:

Apply geoconcept-20080223.patch (except for the makefile)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/ogr/ogrsf_frmts/geoconcept/drv_geoconcept.html

    r13555 r13869  
    11<html> 
    22<head> 
    3 <title>G&eacute;oconcept Export</title> 
     3<title>GeoConcept Export</title> 
    44</head> 
    55 
    66<body bgcolor="#ffffff"> 
    77 
    8 <h1>G&eacute;oconcept text export</h1> 
    9  
    10 G&eacute;oconcept text export files should be available for writing and reading.<p> 
    11  
    12 The OGR G&eacute;oconcept driver treats a single G&eacute;oconcept file within 
     8<h1>GeoConcept text export</h1> 
     9 
     10GeoConcept text export files should be available for writing and reading.<p> 
     11 
     12The OGR GeoConcept driver treats a single GeoConcept file within 
    1313a directory as a dataset comprising layers. 
    14 G&eacute;oconcept files extensions are <code>.txt</code> or <code>.gxt</code>.<p> 
    15  
    16 Currently the G&eacute;oconcept driver only supports multi-polygons, lines and 
     14GeoConcept files extensions are <code>.txt</code> or <code>.gxt</code>.<p> 
     15 
     16Currently the GeoConcept driver only supports multi-polygons, lines and 
    1717points.<p> 
    1818 
     19<h2>GeoConcept Text File Format (gxt)</h2> 
     20 
     21GeoConcept is a GIS developped by the Company GeoConcept SA. <p> 
     22 
     23It's an object oriented GIS, where the features are named &laquo;&nbsp;objects&nbsp;&raquo;, 
     24and feature types are named &laquo;&nbsp;type/subtype&nbsp;&raquo; (class allowing inheritance).<p> 
     25 
     26Among its import/export formats, it proposes a simple text format 
     27named gxt. A gxt file may contain objects from several type/subtype.<p> 
     28 
     29GeoConcept text export files should be available for writing and reading. <p> 
     30 
     31The OGR GeoConcept driver treats a single GeoConcept file within a 
     32directory as a dataset comprising layers. GeoConcept files extensions 
     33are <code>.txt</code> or <code>.gxt</code>.<p> 
     34 
     35Currently the GeoConcept driver only supports multi-polygons, 
     36lines and points.<p> 
     37 
    1938<h2>Creation Issues</h2> 
    2039 
    21 The G&eacute;oconcept driver treats a G&eacute;oconcept file (<code>.txt</code> 
     40The GeoConcept driver treats a GeoConcept file (<code>.txt</code> 
    2241or <code>.gxt</code>) as a dataset.<p> 
    2342 
    24 G&eacute;oconcept files can store multiple kinds of geometry (one by layer), 
    25 even if a G&eacute;oconcept layer can only have one kind of geometry.<p> 
     43GeoConcept files can store multiple kinds of geometry (one by layer), 
     44even if a GeoConcept layer can only have one kind of geometry.<p> 
    2645 
    2746Note this makes it very difficult to translate a mixed geometry layer 
    28 from another format into G&eacute;oconcept format using ogr2ogr, since ogr2ogr has 
     47from another format into GeoConcept format using ogr2ogr, since ogr2ogr has 
    2948no support for separating out geometries from a source layer.<p> 
    3049 
    31 G&eacute;oconcept sub-type is treated as OGR feature. The name of a layer is therefore 
    32 the concatenation of the G&eacute;oconcept type name, <code>'.'</code> and G&eacute;oconcept 
     50GeoConcept sub-type is treated as OGR feature. The name of a layer is therefore 
     51the concatenation of the GeoConcept type name, <code>'.'</code> and GeoConcept 
    3352sub-type name.<p> 
    3453 
    35 G&eacute;oconcept type definition (<code>.gct</code> files) are used for creation only.<p> 
    36  
    37 G&eacute;oconcept feature fields definition are stored in an associated <code>.gct</code> 
     54GeoConcept type definition (<code>.gct</code> files) are used for creation only.<p> 
     55 
     56GeoConcept feature fields definition are stored in an associated <code>.gct</code> 
    3857file, and so fields suffer a number of limitations (<span style="color:red;">FIXME</span>)&nbsp;:<p> 
    3958 
     
    4362<li> Only Integer, Real and String field types are supported.  The various 
    4463list, and other field types cannot be created for the moment (they exist in 
    45 the G&eacute;oconcept model, but are not yet supported by the G&eacute;oconcept 
     64the GeoConcept model, but are not yet supported by the GeoConcept 
    4665driver).</li> 
    4766</ul> 
    4867 
    49 The OGR G&eacute;oconcept driver does not support deleting features. <p>  
     68The OGR GeoConcept driver does not support deleting features. <p>  
    5069 
    5170<h3>Dataset Creation Options</h3> 
    5271 
    53 <b>EXTENSION=TXT|GXT</b>&nbsp;: indicates the G&eacute;oconcept export file extension. <code>TXT</code> 
    54 was used by earlier releases of G&eacute;oconcept. <code>GXT</code> is currently used.<p> 
    55  
    56 <b>CONFIG=path to the GCT</b>&nbsp;: the GCT file describe the G&eacute;oconcept types 
     72<b>EXTENSION=TXT|GXT</b>&nbsp;: indicates the GeoConcept export file extension. <code>TXT</code> 
     73was used by earlier releases of GeoConcept. <code>GXT</code> is currently used.<p> 
     74 
     75<b>CONFIG=path to the GCT</b>&nbsp;: the GCT file describe the GeoConcept types 
    5776definitions&nbsp;: In this file, every line must start with <code>//#</code> followed by 
    5877a keyword. Lines starting with <code>//</code> are comments.<p> 
    5978 
    60 It is important to note that a G&eacute;oconcept export file can hold different types and 
     79It is important to note that a GeoConcept export file can hold different types and 
    6180associated sub-types.<p> 
    6281 
     
    206225</pre> 
    207226 
    208 <h4>Example of a G&eacute;oconcept text export :</h4> 
     227<h4>Example of a GeoConcept text export :</h4> 
    209228 
    210229<pre> 
     
    225244<h4>Example of use :</h4> 
    226245 
    227 Creating a G&eacute;oconcept export file&nbsp;:<br/> 
     246Creating a GeoConcept export file&nbsp;:<br/> 
    228247 
    229248<pre> 
     
    231250</pre> 
    232251 
    233 Appending new features to an existing G&eacute;oconcept export file&nbsp;:<br/> 
     252Appending new features to an existing GeoConcept export file&nbsp;:<br/> 
    234253 
    235254<pre> 
     
    237256</pre> 
    238257 
    239 Translating a G&eacute;oconcept export file layer into MapInfo file&nbsp;:<br/> 
     258Translating a GeoConcept export file layer into MapInfo file&nbsp;:<br/> 
    240259 
    241260<pre> 
     
    246265 
    247266<ul> 
    248 <li> <a href="http://www.geoconcept.com/">G&eacute;oconcept web site</a></li> 
     267<li> <a href="http://www.geoconcept.com/">GeoConcept web site</a></li> 
    249268</ul> 
    250269 
  • trunk/gdal/ogr/ogrsf_frmts/geoconcept/geoconcept_syscoord.c

    r13625 r13869  
    3535GCSRS_CVSID("$Id: geoconcept_syscoord.c,v 1.0.0 2007-12-24 15:40:28 drichard Exp $") 
    3636 
     37#ifndef PI 
     38#define PI 3.14159265358979323846 
     39#endif 
     40 
     41 
     42/* -------------------------------------------------------------------- */ 
     43/*      GCSRS globals                                                   */ 
     44/* -------------------------------------------------------------------- */ 
     45 
     46/* 
     47 * The following information came from GEO CONCEPT PROJECTION files, 
     48 * aka GCP files. 
     49 * A lot of information has been added to these GCP. There are mostly 
     50 * noticed as FIXME in the source. 
     51 */ 
     52 
     53static GCSysCoord gk_asSysCoordList[]= 
     54/* 
     55 * pszSysCoordName, pszUnit, dfPM, dfLambda0, dfPhi0, dfk0, dfX0, dfY0, dfPhi1, dfPhi2, nDatumID, nProjID, coordSystemID, timeZoneValue 
     56 * 
     57 * #12, #14, #15, #17 : parameters listed below are "generic" ... 
     58 * 
     59 * Geoconcept uses cos(lat_ts) as scale factor, but cos(lat_ts)==cos(-lat_ts) : I then set dfPhi1 with lat_ts 
     60 */ 
     61{ 
     62{"Lambert 2 extended",              NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000, 2200000.000,  0.0,  0.0,  13,   2,    1,-1}, 
     63{"Lambert 1",                       NULL,  2.337229166667,   0.000000000, 49.50000000,0.99987734000, 600000.000,  200000.000,  0.0,  0.0,  13,   2,    2,-1}, 
     64{"Lambert 2",                       NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000,  200000.000,  0.0,  0.0,  13,   2,    3,-1}, 
     65{"Lambert 3",                       NULL,  2.337229166667,   0.000000000, 44.10000000,0.99987750000, 600000.000,  200000.000,  0.0,  0.0,  13,   2,    4,-1}, 
     66{"Lambert 4",                       NULL,  2.337229166667,   0.000000000, 42.16500000,0.99994471000,    234.358,  185861.369,  0.0,  0.0,  13,   2,    5,-1}, 
     67{"Bonne NTF",                       NULL,  2.337222222222,   0.000000000, 48.86000000,1.00000000000,      0.000,       0.000,  0.0,  0.0,   1,   3,   11,-1}, 
     68{"UTM Nord - ED50",                 NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,  14,   1,   12, 0}, 
     69{"Plate carrée",                    NULL,  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,  11,   4,   13,-1}, 
     70{"MGRS (Military UTM)",             NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000,      0.000,       0.000,  0.0,  0.0,   4,  11,   14,-1}, 
     71{"UTM Sud - WGS84",                 NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,   4,   1,   15, 0}, 
     72{"National GB projection",          NULL,  0.000000000000,  -2.000000000, 49.00000000,0.99960127170, 400000.000, -100000.000,  0.0,  0.0,  12,  12,   16,-1}, 
     73{"UTM Nord - WGS84",                NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,   4,   1,   17, 0}, 
     74{"UTM Nord - WGS84",                NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,9990,   1,   17, 0}, 
     75{"Lambert 2 étendu - sans grille",  NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000, 2200000.000,  0.0,  0.0,   1,   2,   91,-1}, 
     76{"Lambert 1 - sans grille",         NULL,  2.337229166667,   0.000000000, 49.50000000,0.99987734000, 600000.000,  200000.000,  0.0,  0.0,   1,   2,   92,-1}, 
     77{"Lambert 2 - sans grille",         NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000,  200000.000,  0.0,  0.0,   1,   2,   93,-1}, 
     78{"Lambert 3 - sans grille",         NULL,  2.337229166667,   0.000000000, 44.10000000,0.99987750000, 600000.000,  200000.000,  0.0,  0.0,   1,   2,   94,-1}, 
     79{"Lambert 4 - sans grille",         NULL,  2.337229166667,   0.000000000, 42.16500000,0.99994471000,    234.358,  185861.369,  0.0,  0.0,   1,   2,   95,-1}, 
     80{"(Long/Lat) NTF",                   "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   1,   0,  100,-1}, 
     81{"(Long/Lat) WGS84",                 "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   4,   0,  101,-1}, 
     82{"(Long/Lat) ED50",                  "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,  14,   0,  102,-1}, 
     83{"(Long/Lat) Australian 1984",       "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   7,   0,  103,-1}, 
     84{"(Long/Lat) Airy",                  "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,  12,   0,  104,-1}, 
     85{"(Long/Lat) NTF Paris (gr)",       "gr",  2.337229166667,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   1,   0,  105,-1}, 
     86{"(Long/Lat) WGS 72",                "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   3,   0,  107,-1}, 
     87{"Geoportail MILLER",               NULL,  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   4,  24,  222,-1}, 
     88{"IGN-RRAFGUADU20",                 NULL,  0.000000000000, -63.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,9984,   1,  501,-1},/* FIXME does not exist in IGNF, use IGN-UTM20W84GUAD instead */ 
     89{"IGN-RRAFMARTU20",                 NULL,  0.000000000000, -63.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,9984,   1,  502,-1},/* FIXME does not exist in IGNF, use IGN-UTM20W84MART instead, never reached cause identical to 501:-1 */ 
     90{"IGN-RGM04UTM38S",                 NULL,  0.000000000000,  45.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  503,-1},/* FIXME 5030 datum changed into 9984 */ 
     91{"IGN-RGR92UTM40S",                 NULL,  0.000000000000,  57.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  504,-1}, 
     92{"IGN-UTM22RGFG95",                 NULL,  0.000000000000, -51.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,9984,   1,  505,-1}, 
     93{"IGN-UTM01SWG84",                  NULL,  0.000000000000,-177.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  506,-1},/* FIXME never reached cause identical to 516:-1 */ 
     94{"IGN-RGSPM06U21",                  NULL,  0.000000000000, -57.000000000,  0.00000000,0.99960000000, 500000.000,       0.000,  0.0,  0.0,9984,   1,  507,-1}, 
     95{"IGN-RGPFUTM5S",                   NULL,  0.000000000000,-153.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  508,-1}, 
     96{"IGN-RGPFUTM6S",                   NULL,  0.000000000000,-147.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  509,-1}, 
     97{"IGN-RGPFUTM7S",                   NULL,  0.000000000000,-141.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  510,-1}, 
     98{"IGN-CROZ63UTM39S",                NULL,  0.000000000000,  51.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9983,   1,  511,-1}, 
     99{"IGN-WGS84UTM1S",                  NULL,  0.000000000000,-177.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,   4,   1,  512,-1}, 
     100{"IGN-RGNCUTM57S",                  NULL,  0.000000000000, 159.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  513,-1}, 
     101{"IGN-RGNCUTM58S",                  NULL,  0.000000000000, 165.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  514,-1}, 
     102{"IGN-RGNCUTM59S",                  NULL,  0.000000000000, 171.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9984,   1,  515,-1}, 
     103{"IGN-KERG62UTM42S",                NULL,  0.000000000000,  69.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,9988,   1,  516,-1}, 
     104{"IGN-REUN47GAUSSL",                NULL,  0.000000000000,  55.533333333,-21.11666667,1.00000000000, 160000.000,   50000.000,  0.0,  0.0,   2,  19,  520,-1}, 
     105{"Lambert 1 Carto",                 NULL,  2.337229166667,   0.000000000, 49.50000000,0.99987734000, 600000.000, 1200000.000,  0.0,  0.0,  13,   2, 1002,-1}, 
     106{"Lambert 2 Carto",                 NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000, 2200000.000,  0.0,  0.0,  13,   2, 1003,-1},/* never reached cause identical to 1:-1 */ 
     107{"Lambert 3 Carto",                 NULL,  2.337229166667,   0.000000000, 44.10000000,0.99987750000, 600000.000, 3200000.000,  0.0,  0.0,  13,   2, 1004,-1}, 
     108{"Lambert 4 Carto",                 NULL,  2.337229166667,   0.000000000, 42.16500000,0.99994471000,    234.358, 4185861.369,  0.0,  0.0,  13,   2, 1005,-1}, 
     109{"Lambert 93",                      NULL,  0.000000000000,   3.000000000, 46.50000000,0.00000000000, 700000.000, 6600000.000, 44.0, 49.0,9984,  18, 1006,-1}, 
     110{"IGN-RGNCLAM",                     NULL,  0.000000000000, 166.000000000,-21.30000000,0.00000000000, 400000.000,  300000.000,-20.4,-22.2,9984,  18, 1007,-1},/* Wrong projection was 2 */ 
     111{"Lambert 1 Carto - sans grille",   NULL,  2.337229166667,   0.000000000, 49.50000000,0.99987734000, 600000.000, 1200000.000,  0.0,  0.0,   1,   2, 1092,-1}, 
     112{"Lambert 2 Carto - sans grille",   NULL,  2.337229166667,   0.000000000, 46.80000000,0.99987742000, 600000.000, 2200000.000,  0.0,  0.0,   1,   2, 1093,-1}, 
     113{"Lambert 3 Carto - sans grille",   NULL,  2.337229166667,   0.000000000, 44.10000000,0.99987750000, 600000.000, 3200000.000,  0.0,  0.0,   1,   2, 1094,-1}, 
     114{"Lambert 4 Carto - sans grille",   NULL,  2.337229166667,   0.000000000, 42.16500000,0.99994471000,    234.358,  185861.369,  0.0,  0.0,   1,   2, 1095,-1}, 
     115{"Suisse",                          NULL,  0.000000000000,   7.439583333, 46.95240556,1.00000000000, 600000.000,  200000.000,  0.0,  0.0,   2,  25, 1556,-1}, 
     116{"Geoportail France",               NULL,  0.000000000000,   0.000000000,  0.00000000,0.68835457569,      0.000,       0.000, 46.5,  0.0,9984,  26, 2012,-1}, 
     117{"Geoportail Antilles",             NULL,  0.000000000000,   0.000000000,  0.00000000,0.96592582629,      0.000,       0.000, 15.0,  0.0,9984,  26, 2016,-1}, 
     118{"Geoportail Guyane",               NULL,  0.000000000000,   0.000000000,  0.00000000,0.99756405026,      0.000,       0.000,  4.0,  0.0,9984,  26, 2017,-1}, 
     119{"Geoportail Reunion",              NULL,  0.000000000000,   0.000000000,  0.00000000,0.93358042649,      0.000,       0.000,-21.0,  0.0,9984,  26, 2018,-1}, 
     120{"Geoportail Mayotte",              NULL,  0.000000000000,   0.000000000,  0.00000000,0.97814760073,      0.000,       0.000,-12.0,  0.0,9984,  26, 2019,-1}, 
     121{"Geoportail ST Pierre et Miquelon",NULL,  0.000000000000,   0.000000000,  0.00000000,0.68199836006,      0.000,       0.000, 47.0,  0.0,9984,  26, 2020,-1}, 
     122{"Geoportail Nouvelle Caledonie",   NULL,  0.000000000000,   0.000000000,  0.00000000,0.92718385456,      0.000,       0.000,-22.0,  0.0,9984,  26, 2021,-1}, 
     123{"Geoportail Wallis",               NULL,  0.000000000000,   0.000000000,  0.00000000,0.97029572627,      0.000,       0.000,-14.0,  0.0,9984,  26, 2022,-1}, 
     124{"Geoportail Polynesie",            NULL,  0.000000000000,   0.000000000,  0.00000000,0.96592582628,      0.000,       0.000,-15.0,  0.0,9984,  26, 2023,-1}, 
     125{"Mercator sur sphère WGS84",       NULL,  0.000000000000,   0.000000000,  0.00000000,1.00000000000,      0.000,       0.000,  0.0,  0.0,2015,  21, 2027,-1}, 
     126{"(Long/Lat) RGF 93",                "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,  13,   0, 2028,-1}, 
     127{"Geoportail Crozet",               NULL,  0.000000000000,   0.000000000,  0.00000000,0.69465837046,      0.000,       0.000,-46.0,  0.0,9984,  26, 2040,-1},/* FIXME : wrong scale factor was 0.69088241108 */ 
     128{"Geoportail Kerguelen",            NULL,  0.000000000000,   0.000000000,  0.00000000,0.64944804833,      0.000,       0.000,-49.5,  0.0,9984,  26, 2042,-1},/* FIXME : wrong scale factor was 0.67815966987 */ 
     129{"Lambert CC 42",                   NULL,  0.000000000000,   3.000000000, 42.00000000,0.00000000000,1700000.000, 1200000.000, 41.2, 42.8,9984,  18, 2501,-1}, 
     130{"Lambert CC 43",                   NULL,  0.000000000000,   3.000000000, 43.00000000,0.00000000000,1700000.000, 2200000.000, 42.2, 43.8,9984,  18, 2502,-1}, 
     131{"Lambert CC 44",                   NULL,  0.000000000000,   3.000000000, 44.00000000,0.00000000000,1700000.000, 3200000.000, 43.2, 44.8,9984,  18, 2503,-1}, 
     132{"Lambert CC 45",                   NULL,  0.000000000000,   3.000000000, 45.00000000,0.00000000000,1700000.000, 4200000.000, 44.2, 45.8,9984,  18, 2504,-1}, 
     133{"Lambert CC 46",                   NULL,  0.000000000000,   3.000000000, 46.00000000,0.00000000000,1700000.000, 5200000.000, 45.2, 46.8,9984,  18, 2505,-1}, 
     134{"Lambert CC 47",                   NULL,  0.000000000000,   3.000000000, 47.00000000,0.00000000000,1700000.000, 6200000.000, 46.2, 47.8,9984,  18, 2506,-1}, 
     135{"Lambert CC 48",                   NULL,  0.000000000000,   3.000000000, 48.00000000,0.00000000000,1700000.000, 7200000.000, 47.2, 48.8,9984,  18, 2507,-1}, 
     136{"Lambert CC 49",                   NULL,  0.000000000000,   3.000000000, 49.00000000,0.00000000000,1700000.000, 8200000.000, 48.2, 49.8,9984,  18, 2508,-1}, 
     137{"Lambert CC 50",                   NULL,  0.000000000000,   3.000000000, 50.00000000,0.00000000000,1700000.000, 9200000.000, 49.2, 50.8,9984,  18, 2509,-1}, 
     138{"(Long/Lat) IGN-RGM04GEO",          "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10001,-1}, 
     139{"(Long/Lat) IGN-RGFG95GEO",         "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10002,-1},/* FIXME never reached, identical to 10001:-1 */ 
     140{"(Long/Lat) IGN-WGS84RRAFGEO",      "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10003,-1},/* FIXME never reached, identical to 10001:-1 */ 
     141{"(Long/Lat) IGN-RGR92GEO",          "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10004,-1},/* FIXME never reached, identical to 10001:-1 */ 
     142{"(Long/Lat) IGN-WGS84G",            "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   4,   0,10005,-1}, 
     143{"(Long/Lat) CROZ63GEO",             "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,   4,   0,10006,-1}, 
     144{"(Long/Lat) RGSPM06GEO",            "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10007,-1},/* FIXME never reached, identical to 10001:-1 */ 
     145{"(Long/Lat) RGPFGEO",               "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10008,-1},/* FIXME never reached, identical to 10001:-1 */ 
     146{"(Long/Lat) RGNCGEO",               "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9984,   0,10009,-1},/* FIXME never reached, identical to 10001:-1 */ 
     147{"(Long/Lat) KER62GEO",              "d",  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,9988,   0,10010,-1}, 
     148{"UTM Sud - ED50",                  NULL,  0.000000000000,   0.000000000,  0.00000000,0.99960000000, 500000.000,10000000.000,  0.0,  0.0,  14,   1,99912, 0},/* FIXME allow retrieving 12:0 - See _findSysCoord_GCSRS() */ 
     149{NULL,                              NULL,  0.000000000000,   0.000000000,  0.00000000,0.00000000000,      0.000,       0.000,  0.0,  0.0,  -1,  -1,   -1,-1} 
     150}; 
     151 
     152static GCProjectionInfo gk_asProjList[]= 
     153/* 
     154 * pszProjName, nSphere, nProjID 
     155 */ 
     156{ 
     157{"Geographic shift",        0,    0}, 
     158{"UTM",                     0,    1}, 
     159{"Lambert Conform Conic",   0,    2}, 
     160{"Bonne",                   0,    3}, 
     161{"Plate carrée",            0,    4}, 
     162{"MGRS (Military UTM)",     0,   11}, 
     163{"Transversal Mercator",    0,   12}, 
     164{"Lambert secant",          0,   18}, 
     165{"Gauss Laborde",           1,   19}, 
     166{"Polyconic",               0,   20}, 
     167{"Direct Mercator",         0,   21}, 
     168{"Stereographic oblic",     1,   22}, 
     169{"Miller",                  0,   24}, 
     170{"Mercator oblic",          1,   25}, 
     171{"Equi rectangular",        1,   26}, 
     172 
     173{NULL,                      0,   -1} 
     174}; 
     175 
     176static GCDatumInfo gk_asDatumList[]= 
     177  /* 
     178   * pszDatumName, dfShiftX, dfShiftY, dfShiftZ, dfRotX, dfRotY, dfRotZ, dfScaleFactor, dfFA, dfFlattening, nEllipsoidID, nDatumID 
     179   */ 
     180  /* 
     181   * Wrong dx, dy, dz : 
     182   * IGN-RGM04GEO, was -217, -216, 67 
     183   * IGN-RGFG95GEO, was -2, -2, 2 
     184   * IGN-RGSPM06GEO, was -125.593, 143.763, -194.558 
     185   * 
     186   * #1 and #14 are identical 
     187   * #8, #11, #2015 are spherical views of #4 
     188   * #5030, #5031 and #5032 are identical 
     189   * FIXME : #5030, #5031, #5032 are ITRS89 compliant, so "compatible" with #4, better use #9999 as ellipsoid 
     190   * FIXME : #9999 to #9986 added 
     191   */ 
     192{ 
     193{"NTF (Clarke 1880)",               -168.0000, -60.0000, 320.0000, 0.00000, 0.00000,  0.00000,  0.0,       -112.200,-54.7388e-6,       3,   1}, 
     194{"ED50 France (International 1909)", -84.0000, -97.0000,-117.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,   2}, 
     195{"WGS 72",                             0.0000,  12.0000,   6.0000, 0.00000, 0.00000,  0.00000,  0.0,          2.000,  0.0312e-6,       6,   3}, 
     196{"WGS 84",                             0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,          9999,   4}, 
     197{"ED 79",                            -83.0000, -95.0000,-116.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,   5}, 
     198{"Australian Geodetic 1966",        -133.0000, -48.0000, 148.0000, 0.00000, 0.00000,  0.00000,  0.0,        -23.000, -0.0081e-6,       7,   6}, 
     199{"Australian Geodetic 1984",        -134.0000, -48.0000, 149.0000, 0.00000, 0.00000,  0.00000,  0.0,        -23.000, -0.0081e-6,       7,   7}, 
     200{"Sphere",                             0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             1,   8}, 
     201{"Sphere DCW",                         0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             1,  11}, 
     202{"Airy",                             375.0000,-111.0000, 431.0000, 0.00000, 0.00000,  0.00000,  0.0,        573.604, 11.96002325e-6,   8,  12}, 
     203{"NTF-Grille",                      -168.0000, -60.0000, 320.0000, 0.00000, 0.00000,  0.00000,  0.0,       -112.200,-54.7388e-6,       3,  13}, 
     204{"ED50 (International 1909)",        -87.0000, -98.0000,-121.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,  14}, 
     205{"WGS 84 sur sphere",                  0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             1,2015}, 
     206{"IGN-RGM04GEO",                       0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             4,5030}, 
     207{"IGN-RGFG95GEO",                      0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             4,5031}, 
     208{"IGN-RGSPM06GEO",                     0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             4,5032}, 
     209{"IGN-WALL78",                       253.0000,-133.0000,-127.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,9999},/* FIXME */ 
     210{"IGN-TAHA",                          72.4380, 345.9180,  79.4860,-1.60450,-0.88230, -0.55650,  1.3746e-6, -251.000,-14.1927e-6,       5,9998},/* FIXME */ 
     211{"IGN-MOOREA87",                     215.9820, 149.5930, 176.2290, 3.26240, 1.69200,  1.15710, 10.47730e-6,-251.000,-14.1927e-6,       5,9997},/* FIXME */ 
     212{"IGN-TAHI51",                       162.0000, 117.0000, 154.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,9996},/* FIXME */ 
     213{"IGN-NUKU72",                       165.7320, 216.7200, 180.5050,-0.64340,-0.45120, -0.07910,  7.42040e-6,-251.000,-14.1927e-6,       5,9995},/* FIXME */ 
     214{"IGN-IGN63",                        410.7210,  55.0490,  80.7460,-2.57790,-2.35140, -0.66640, 17.33110e-6,-251.000,-14.1927e-6,       5,9994},/* FIXME */ 
     215{"IGN-MART38",                       126.9260, 547.9390, 130.4090,-2.78670, 5.16124, -0.85844, 13.82265e-6,-251.000,-14.1927e-6,       5,9993},/* FIXME */ 
     216{"IGN-GUAD48",                      -472.2900,  -5.6300,-304.1200, 0.43620,-0.83740,  0.25630,  1.89840e-6,-251.000,-14.1927e-6,       5,9992},/* FIXME */ 
     217{"IGN-GUADFM49",                     136.5960, 248.1480,-429.7890, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,9991},/* FIXME */ 
     218{"IGN-STPM50",                       -95.5930, 573.7630, 173.4420,-0.96020, 1.25100, -1.39180, 42.62650e-6, -69.400,-37.2957e-6,       2,9990},/* FIXME */ 
     219{"IGN-CSG67",                       -193.0660, 236.9930, 105.4470, 0.48140,-0.80740,  0.12760,  1.56490e-6,-251.000,-14.1927e-6,       5,9989},/* FIXME */ 
     220{"IGN-KERG62",                       145.0000,-187.0000, 103.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,9988},/* FIXME */ 
     221{"IGN-REUN47",                       789.5240,-626.4860, -89.9040, 0.60060,76.79460,-10.57880,-32.32410e-6,-251.000,-14.1927e-6,       5,9987},/* FIXME */ 
     222{"IGN-MAYO50",                      -599.9280,-275.5520,-195.6650, 0.08350, 0.47150, -0.06020,-49.28140e-6,-251.000,-14.1927e-6,       5,9986},/* FIXME */ 
     223{"IGN-TAHI79",                       221.5250, 152.9480, 176.7680, 2.38470, 1.38960,  0.87700, 11.47410e-6,-251.000,-14.1927e-6,       5,9985},/* FIXME */ 
     224{"ITRS-89",                            0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,             4,9984}, 
     225{"IGN-CROZ63",                         0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,       -251.000,-14.1927e-6,       5,9983},/* FIXME added cause the Bursa-Wolf parameters are not known */ 
     226 
     227{NULL,                                 0.0000,   0.0000,   0.0000, 0.00000, 0.00000,  0.00000,  0.0,          0.000,  0.0,            -1,  -1} 
     228}; 
     229 
     230static GCSpheroidInfo gk_asSpheroidList[]= 
     231  /* 
     232   * pszSpheroidName, dfA, dfE, nEllipsoidID 
     233   * 
     234   * cause Geoconcept assimilates WGS84 and GRS80, WGS84 is added to the list 
     235   */ 
     236{ 
     237{"Sphere",                     6378137.0000, 0.00000000000000,   1}, 
     238{"Clarke 1866",                6378206.4000, 0.08227185423947,   2},/* Wrong, semi-major was 6378249.4000     */ 
     239{"Clarke 1880",                6378249.2000, 0.08248325676300,   3},/* Wrong, excentricity was 0.082483256945 */ 
     240{"GRS 80",                     6378137.0000, 0.08181919104300,   4},/* Wrong, excentricity was 0.081819191060 */ 
     241{"International 1909",         6378388.0000, 0.08199188997900,   5}, 
     242{"WGS 72",                     6378135.0000, 0.08181881201777,   6}, 
     243{"Australian National",        6378160.0000, 0.08182017998700,   7}, 
     244{"Airy",                       6377563.3960, 0.08167337387420,   8}, 
     245{"WGS 84",                     6378137.0000, 0.08181919078200,9999}, 
     246 
     247{NULL,                         0,            0,                 -1} 
     248}; 
     249 
    37250/* -------------------------------------------------------------------- */ 
    38251/*      GCSRS API Prototypes                                            */ 
    39252/* -------------------------------------------------------------------- */ 
     253 
     254/* -------------------------------------------------------------------- */ 
     255static int GCSRSAPI_CALL _areCompatibleSpheroids_GCSRS ( id1, id2 ) 
     256{ 
     257  if( id1==id2 ) return TRUE; 
     258  
     259  switch( id1 ) 
     260  { 
     261    case    4 : 
     262    case 9999 : 
     263      switch( id2 ) 
     264      { 
     265        case    4 : 
     266        case 9999 : 
     267          return TRUE; 
     268        default   : 
     269          break; 
     270      } 
     271      break; 
     272    default   : 
     273      break; 
     274  } 
     275 
     276  return FALSE; 
     277}/* _areCompatibleSpheroids_GCSRS */ 
     278 
     279/* -------------------------------------------------------------------- */ 
     280static int GCSRSAPI_CALL _areCompatibleDatums_GCSRS ( id1, id2 ) 
     281{ 
     282  if( id1==id2 ) return TRUE; 
     283  
     284  switch( id1 ) 
     285  { 
     286    case    1 : /* NTF */ 
     287    case   13 : 
     288      switch( id2 ) 
     289      { 
     290        case    1 : 
     291        case   13 : 
     292          return TRUE; 
     293        default   : 
     294          break; 
     295      } 
     296      break; 
     297    case    2 : /* ED50 */ 
     298    case   14 : 
     299    case 9983 : 
     300    case 9985 : 
     301    case 9986 : 
     302    case 9987 : 
     303    case 9989 : 
     304    case 9991 : 
     305    case 9992 : 
     306    case 9993 : 
     307    case 9994 : 
     308    case 9995 : 
     309    case 9997 : 
     310    case 9998 : 
     311    case 9999 : 
     312      switch( id2 ) 
     313      { 
     314        case    2 : 
     315        case   14 : 
     316        case 9983 : 
     317        case 9985 : 
     318        case 9986 : 
     319        case 9987 : 
     320        case 9989 : 
     321        case 9991 : 
     322        case 9992 : 
     323        case 9993 : 
     324        case 9994 : 
     325        case 9995 : 
     326        case 9997 : 
     327        case 9998 : 
     328        case 9999 : 
     329          return TRUE; 
     330        default   : 
     331          break; 
     332      } 
     333      break; 
     334    case    4 : /* WGS84 - ITRS89  */ 
     335    case    8 : 
     336    case   11 : 
     337    case 2015 : 
     338    case 5030 : 
     339    case 5031 : 
     340    case 5032 : 
     341    case 9984 : 
     342      switch( id2 ) 
     343      { 
     344        case    4 : 
     345        case    8 : 
     346        case   11 : 
     347        case 2015 : 
     348        case 5030 : 
     349        case 5031 : 
     350        case 5032 : 
     351        case 9984 : 
     352          return TRUE; 
     353        default   : 
     354          break; 
     355      } 
     356      break; 
     357    default   : 
     358      break; 
     359  } 
     360 
     361  return FALSE; 
     362}/* _areCompatibleDatums_GCSRS */ 
     363 
     364#define _CPLDebugSpheroid_GCSRS(e) \ 
     365CPLDebug( "GEOCONCEPT", "SemiMajor:%.4f;Excentricity:%.10f;",\ 
     366          GetInfoSpheroidSemiMajor_GCSRS(e),\ 
     367          GetInfoSpheroidExcentricity_GCSRS(e)\ 
     368); 
     369 
     370/* -------------------------------------------------------------------- */ 
     371static GCSpheroidInfo GCSRSAPI_CALL1(*) _findSpheroid_GCSRS ( double a, double rf ) 
     372{ 
     373  int iSpheroid, iResol= 0, nResol= 2; 
     374  GCSpheroidInfo* ell; 
     375  double e, p[]= {1e-10, 1e-8}; 
     376 
     377  /* f = 1 - sqrt(1 - e^2) */ 
     378  e= 1.0/rf; 
     379  e= sqrt(e*(2.0-e)); 
     380ell_relax: 
     381  for( iSpheroid= 0, ell= &(gk_asSpheroidList[0]); 
     382       GetInfoSpheroidID_GCSRS(ell)!=-1; 
     383       iSpheroid++, ell= &(gk_asSpheroidList[iSpheroid]) ) 
     384  { 
     385    if( fabs(GetInfoSpheroidSemiMajor_GCSRS(ell) - a) > 1e-4 ) continue; 
     386    if( fabs(GetInfoSpheroidExcentricity_GCSRS(ell) - e) > p[iResol] ) continue; 
     387    break; 
     388  } 
     389  if( GetInfoSpheroidID_GCSRS(ell)==-1 && iResol!=nResol-1 ) 
     390  { 
     391    iResol++; 
     392    goto ell_relax; 
     393  } 
     394 
     395  return ell; 
     396}/* _findSpheroid_GCSRS */ 
     397 
     398#define _CPLDebugDatum_GCSRS(d) \ 
     399CPLDebug( "GEOCONCEPT", "ID:%d;ShiftX:%.4f;ShiftY:%.4f;ShiftZ:%.4f;DiffA:%.4f;DiffFlattening:%.7f;",\ 
     400  GetInfoDatumID_GCSRS((d)),\ 
     401  GetInfoDatumShiftX_GCSRS((d)),\ 
     402  GetInfoDatumShiftY_GCSRS((d)),\ 
     403  GetInfoDatumShiftZ_GCSRS((d)),\ 
     404  GetInfoDatumDiffA_GCSRS((d)),\ 
     405  GetInfoDatumDiffFlattening_GCSRS((d))\ 
     406); 
     407 
     408/* -------------------------------------------------------------------- */ 
     409static GCDatumInfo GCSRSAPI_CALL1(*) _findDatum_GCSRS ( double dx, 
     410                                                        double dy, 
     411                                                        double dz, 
     412                                                        double a, 
     413                                                        double f ) 
     414{ 
     415  int iDatum, bRelax= FALSE; 
     416  GCDatumInfo* datum; 
     417 
     418datum_relax: 
     419  for( iDatum= 0, datum= &(gk_asDatumList[0]); 
     420       GetInfoDatumID_GCSRS(datum)!=-1; 
     421       iDatum++, datum= &(gk_asDatumList[iDatum]) ) 
     422  { 
     423    if( !bRelax ) 
     424    { 
     425      if( fabs(GetInfoDatumShiftX_GCSRS(datum) - dx) > 1e-4 ) continue; 
     426      if( fabs(GetInfoDatumShiftY_GCSRS(datum) - dy) > 1e-4 ) continue; 
     427      if( fabs(GetInfoDatumShiftZ_GCSRS(datum) - dz) > 1e-4 ) continue; 
     428    } 
     429    if( fabs(GetInfoDatumDiffA_GCSRS(datum) - (6378137.0000-a)) > 1e-4 ) continue; 
     430    if( fabs(GetInfoDatumDiffFlattening_GCSRS(datum) - (0.003352779565406696648-f)) > 1e-7 ) continue; 
     431    break; 
     432  } 
     433  if( GetInfoDatumID_GCSRS(datum)==-1 && !bRelax ) 
     434  { 
     435    /* 
     436     * FIXME : when both nadgrids and towgs84 are defined, bursa-wolf parameters are lost ! 
     437     *         if the projection and the ellipsoid are known, one can retrieve the datum  
     438     *         Try relaxed search ... 
     439     */ 
     440    bRelax= TRUE; 
     441    goto datum_relax; 
     442  } 
     443 
     444  return datum; 
     445}/* _findDatum_GCSRS */ 
     446 
     447/* -------------------------------------------------------------------- */ 
     448static GCProjectionInfo GCSRSAPI_CALL1(*) _findProjection_GCSRS ( const char* p, double lat_ts ) 
     449{ 
     450  int iProj; 
     451  GCProjectionInfo* proj; 
     452 
     453  for( iProj= 0, proj= &(gk_asProjList[0]); 
     454       GetInfoProjID_GCSRS(proj)!=-1; 
     455       iProj++, proj= &(gk_asProjList[iProj]) ) 
     456  { 
     457    if( iProj==0 && p==NULL) 
     458      break; 
     459    if( iProj==1 &&  
     460        ( EQUAL(p,SRS_PT_TRANSVERSE_MERCATOR)               || 
     461          EQUAL(p,SRS_PT_TRANSVERSE_MERCATOR_SOUTH_ORIENTED) ) ) 
     462      break; 
     463    if( iProj==2 && 
     464        EQUAL(p,SRS_PT_LAMBERT_CONFORMAL_CONIC_1SP) ) 
     465      break; 
     466    if( iProj==3 && 
     467        EQUAL(p,SRS_PT_BONNE) ) 
     468      break; 
     469    if( iProj==4 && 
     470        EQUAL(p,SRS_PT_EQUIRECTANGULAR) && 
     471        lat_ts==0.0 ) 
     472      break; 
     473    /* FIXME : iProj==6 ? */ 
     474    if( iProj==7 && 
     475        ( EQUAL(p,SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP) || 
     476          EQUAL(p,SRS_PT_LAMBERT_CONFORMAL_CONIC_2SP_BELGIUM) ) ) 
     477      break; 
     478    if( iProj==8 && 
     479        EQUAL(p,SRS_PT_GAUSSLABORDEREUNION) ) 
     480      break; 
     481    if( iProj==9 && 
     482        EQUAL(p,SRS_PT_POLYCONIC) ) 
     483      break; 
     484    /* FIXME 
     485    if( iProj==10 && 
     486        ( EQUAL(p,SRS_PT_MERCATOR_1SP) || 
     487          EQUAL(p,SRS_PT_MERCATOR_2SP) ) ) 
     488      break; 
     489     */ 
     490    if( iProj==11 && 
     491        ( EQUAL(p,SRS_PT_OBLIQUE_STEREOGRAPHIC) || 
     492          EQUAL(p,SRS_PT_POLAR_STEREOGRAPHIC) ) ) 
     493      break; 
     494    if( iProj==12 && 
     495        EQUAL(p,SRS_PT_MILLER_CYLINDRICAL) ) 
     496      break; 
     497    /* FIXME 
     498    if( iProj==13 && 
     499        ( EQUAL(p,SRS_PT_HOTINE_OBLIQUE_MERCATOR) || 
     500          EQUAL(p,SRS_PT_HOTINE_OBLIQUE_MERCATOR_TWO_POINT_NATURAL_ORIGIN) || 
     501          EQUAL(p,SRS_PT_LABORDE_OBLIQUE_MERCATOR) ) ) 
     502      break; 
     503     */ 
     504    if( iProj==14 && 
     505        EQUAL(p,SRS_PT_EQUIRECTANGULAR) && 
     506        lat_ts!=0.0 ) 
     507      break; 
     508  } 
     509 
     510  return proj; 
     511}/* _findProjection_GCSRS */ 
     512 
     513#define _CPLDebugSysCoord_GCSRS(m,s) \ 
     514CPLDebug( "GEOCONCEPT", "[%s]ID=%d;Zone=%d;DatumID=%d;ProjID=%d;PrimeMeridian=%.10f;CentralMeridian=%.10f;LatitudeOfOrigin=%.10f;StandardParallel1=%.10f;StandardParallel2=%.10f;ScaleFactor=%.10f;FalseEasting=%.10f;FalseNorthing=%.10f;",\ 
     515          (m)? (m):"",\ 
     516          GetSysCoordSystemID_GCSRS((s)),\ 
     517          GetSysCoordTimeZone_GCSRS((s)),\ 
     518          GetSysCoordDatumID_GCSRS((s)),\ 
     519          GetSysCoordProjID_GCSRS((s)),\ 
     520          GetSysCoordPrimeMeridian_GCSRS((s)),\ 
     521          GetSysCoordCentralMeridian_GCSRS((s)),\ 
     522          GetSysCoordLatitudeOfOrigin_GCSRS((s)),\ 
     523          GetSysCoordStandardParallel1_GCSRS((s)),\ 
     524          GetSysCoordStandardParallel2_GCSRS((s)),\ 
     525          GetSysCoordScaleFactor_GCSRS((s)),\ 
     526          GetSysCoordFalseEasting_GCSRS((s)),\ 
     527          GetSysCoordFalseNorthing_GCSRS((s))\ 
     528); 
     529 
     530/* -------------------------------------------------------------------- */ 
     531static GCSysCoord GCSRSAPI_CALL1(*) _findSysCoord_GCSRS ( GCSysCoord* theSysCoord ) 
     532{ 
     533  int iSysCoord, bestSysCoord= -1; 
     534  GCSysCoord* gcsc; 
     535 
     536  if( !theSysCoord) return NULL; 
     537 
     538  SetSysCoordSystemID_GCSRS(theSysCoord, -1); 
     539  SetSysCoordTimeZone_GCSRS(theSysCoord, -1); 
     540  _CPLDebugSysCoord_GCSRS(NULL,theSysCoord); 
     541  for( iSysCoord= 0, gcsc= &(gk_asSysCoordList[0]); 
     542       GetSysCoordSystemID_GCSRS(gcsc)!=-1; 
     543       iSysCoord++, gcsc= &(gk_asSysCoordList[iSysCoord]) ) 
     544  { 
     545    if( !_areCompatibleDatums_GCSRS(GetSysCoordDatumID_GCSRS(gcsc), GetSysCoordDatumID_GCSRS(theSysCoord)) ) continue; 
     546 
     547    if( GetSysCoordProjID_GCSRS(gcsc) != GetSysCoordProjID_GCSRS(theSysCoord) ) continue; 
     548 
     549    if( fabs(GetSysCoordPrimeMeridian_GCSRS(gcsc) - GetSysCoordPrimeMeridian_GCSRS(theSysCoord) ) > 1e-8 ) continue; 
     550 
     551    if( fabs(GetSysCoordCentralMeridian_GCSRS(gcsc) - GetSysCoordCentralMeridian_GCSRS(theSysCoord) ) > 1e-8 ) 
     552    { 
     553      switch( GetSysCoordProjID_GCSRS(gcsc) ) 
     554      { 
     555        case    1 :/* UTM familly : central meridian is the 6* zone - 183 (in degrees) */ 
     556          if( GetSysCoordCentralMeridian_GCSRS(gcsc)==0.0 ) /* generic UTM definition */ 
     557          { 
     558            break; 
     559          } 
     560        default   : 
     561          continue; 
     562      } 
     563    } 
     564    if( fabs(GetSysCoordLatitudeOfOrigin_GCSRS(gcsc) - GetSysCoordLatitudeOfOrigin_GCSRS(theSysCoord) ) > 1e-8 ) continue; 
     565 
     566    if( fabs(GetSysCoordStandardParallel1_GCSRS(gcsc) - GetSysCoordStandardParallel1_GCSRS(theSysCoord) ) > 1e-8 ) continue; 
     567    if( fabs(GetSysCoordStandardParallel2_GCSRS(gcsc) - GetSysCoordStandardParallel2_GCSRS(theSysCoord) ) > 1e-8 ) continue; 
     568 
     569    if( fabs(GetSysCoordScaleFactor_GCSRS(gcsc) - GetSysCoordScaleFactor_GCSRS(theSysCoord) ) > 1e-8 ) continue; 
     570 
     571    if( fabs(GetSysCoordFalseEasting_GCSRS(gcsc) - GetSysCoordFalseEasting_GCSRS(theSysCoord) ) > 1e-4 ) continue; 
     572    if( fabs(GetSysCoordFalseNorthing_GCSRS(gcsc) - GetSysCoordFalseNorthing_GCSRS(theSysCoord) ) > 1e-4 ) continue; 
     573 
     574    /* Found a candidate : */ 
     575    if( bestSysCoord==-1) 
     576    { 
     577      bestSysCoord= iSysCoord; 
     578    } 
     579    else 
     580    { 
     581      switch( GetSysCoordProjID_GCSRS(gcsc) ) 
     582      { 
     583        case    0:/* long/lat */ 
     584          if( GetSysCoordDatumID_GCSRS(gcsc)==GetSysCoordDatumID_GCSRS(theSysCoord) && 
     585              GetSysCoordDatumID_GCSRS(&(gk_asSysCoordList[bestSysCoord]))!=GetSysCoordDatumID_GCSRS(theSysCoord)) /* exact match */ 
     586          { 
     587            bestSysCoord= iSysCoord; 
     588          } 
     589          break; 
     590        case    1:/* UTM familly : central meridian is the 6* zone - 183 (in degrees) */ 
     591          if( GetSysCoordCentralMeridian_GCSRS(gcsc)!=0.0 && 
     592              GetSysCoordDatumID_GCSRS(gcsc)==GetSysCoordDatumID_GCSRS(theSysCoord) && 
     593              GetSysCoordDatumID_GCSRS(&(gk_asSysCoordList[bestSysCoord]))!=GetSysCoordDatumID_GCSRS(theSysCoord)) /* exact match */ 
     594          { 
     595            bestSysCoord= iSysCoord; 
     596          } 
     597          break; 
     598        default  : 
     599          break; 
     600      } 
     601    } 
     602  } 
     603  /* Seems to be the right Geoconcept system: */ 
     604  if( bestSysCoord>=0 ) 
     605  { 
     606    gcsc= &(gk_asSysCoordList[bestSysCoord]); 
     607    switch( GetSysCoordSystemID_GCSRS(gcsc) ) 
     608    { 
     609      case 99912 : /* hack */ 
     610        SetSysCoordSystemID_GCSRS(theSysCoord, 12); 
     611        break; 
     612      default    : 
     613        SetSysCoordSystemID_GCSRS(theSysCoord, GetSysCoordSystemID_GCSRS(gcsc)); 
     614        break; 
     615    } 
     616    SetSysCoordTimeZone_GCSRS(theSysCoord, GetSysCoordTimeZone_GCSRS(gcsc)); 
     617    if( GetSysCoordName_GCSRS(gcsc) ) 
     618      SetSysCoordName_GCSRS(theSysCoord, CPLStrdup(GetSysCoordName_GCSRS(gcsc))); 
     619    if( GetSysCoordUnit_GCSRS(gcsc) ) 
     620      SetSysCoordUnit_GCSRS(theSysCoord, CPLStrdup(GetSysCoordUnit_GCSRS(gcsc))); 
     621  } 
     622 
     623  return theSysCoord; 
     624}/* _findSysCoord_GCSRS */ 
    40625 
    41626/* -------------------------------------------------------------------- */ 
     
    46631  SetSysCoordSystemID_GCSRS(theSysCoord, -1); 
    47632  SetSysCoordTimeZone_GCSRS(theSysCoord, -1); 
     633  SetSysCoordName_GCSRS(theSysCoord, NULL); 
     634  SetSysCoordUnit_GCSRS(theSysCoord, NULL); 
     635  SetSysCoordCentralMeridian_GCSRS(theSysCoord, 0.0); 
     636  SetSysCoordLatitudeOfOrigin_GCSRS(theSysCoord, 0.0); 
     637  SetSysCoordStandardParallel1_GCSRS(theSysCoord, 0.0); 
     638  SetSysCoordStandardParallel2_GCSRS(theSysCoord, 0.0); 
     639  SetSysCoordScaleFactor_GCSRS(theSysCoord, 0.0); 
     640  SetSysCoordFalseEasting_GCSRS(theSysCoord, 0.0); 
     641  SetSysCoordFalseNorthing_GCSRS(theSysCoord, 0.0); 
     642  SetSysCoordDatumID_GCSRS(theSysCoord, -1); 
     643  SetSysCoordProjID_GCSRS(theSysCoord, -1); 
    48644}/* _InitSysCoord_GCSRS */ 
    49645 
     
    54650                                                  ) 
    55651{ 
    56   GCSysCoord* theSysCoord; 
     652  int iSysCoord; 
     653  GCSysCoord* theSysCoord, *gcsc; 
    57654 
    58655  if( !(theSysCoord= CPLMalloc(sizeof(GCSysCoord))) ) 
     
    64661  } 
    65662  _InitSysCoord_GCSRS(theSysCoord); 
    66   SetSysCoordSystemID_GCSRS(theSysCoord, srsid); 
    67   SetSysCoordTimeZone_GCSRS(theSysCoord, timezone); 
     663  if( srsid>=0) 
     664  { 
     665    for( iSysCoord= 0, gcsc= &(gk_asSysCoordList[0]); 
     666         GetSysCoordSystemID_GCSRS(gcsc)!=-1; 
     667         iSysCoord++, gcsc= &(gk_asSysCoordList[iSysCoord]) ) 
     668    { 
     669      if( srsid==GetSysCoordSystemID_GCSRS(gcsc) ) 
     670      { 
     671        SetSysCoordSystemID_GCSRS(theSysCoord, srsid); 
     672        SetSysCoordTimeZone_GCSRS(theSysCoord, timezone); 
     673        if( GetSysCoordName_GCSRS(gcsc) ) 
     674          SetSysCoordName_GCSRS(theSysCoord, CPLStrdup(GetSysCoordName_GCSRS(gcsc))); 
     675        if( GetSysCoordUnit_GCSRS(gcsc) ) 
     676          SetSysCoordUnit_GCSRS(theSysCoord, CPLStrdup(GetSysCoordUnit_GCSRS(gcsc))); 
     677        SetSysCoordCentralMeridian_GCSRS(theSysCoord, GetSysCoordCentralMeridian_GCSRS(gcsc)); 
     678        SetSysCoordLatitudeOfOrigin_GCSRS(theSysCoord, GetSysCoordLatitudeOfOrigin_GCSRS(gcsc)); 
     679        SetSysCoordStandardParallel1_GCSRS(theSysCoord, GetSysCoordStandardParallel1_GCSRS(gcsc)); 
     680        SetSysCoordStandardParallel2_GCSRS(theSysCoord, GetSysCoordStandardParallel2_GCSRS(gcsc)); 
     681        SetSysCoordScaleFactor_GCSRS(theSysCoord, GetSysCoordScaleFactor_GCSRS(gcsc)); 
     682        SetSysCoordFalseEasting_GCSRS(theSysCoord, GetSysCoordFalseEasting_GCSRS(gcsc)); 
     683        SetSysCoordFalseNorthing_GCSRS(theSysCoord, GetSysCoordFalseNorthing_GCSRS(gcsc)); 
     684        SetSysCoordDatumID_GCSRS(theSysCoord, GetSysCoordDatumID_GCSRS(gcsc)); 
     685        SetSysCoordProjID_GCSRS(theSysCoord, GetSysCoordProjID_GCSRS(gcsc)); 
     686        break; 
     687      } 
     688    } 
     689  } 
    68690 
    69691  return theSysCoord; 
     
    75697                                                ) 
    76698{ 
     699  if( GetSysCoordName_GCSRS(theSysCoord) ) 
     700  { 
     701    CPLFree(GetSysCoordName_GCSRS(theSysCoord)); 
     702  } 
     703  if( GetSysCoordUnit_GCSRS(theSysCoord) ) 
     704  { 
     705    CPLFree(GetSysCoordUnit_GCSRS(theSysCoord)); 
     706  } 
    77707  _InitSysCoord_GCSRS(theSysCoord); 
    78708}/* _ReInitSysCoord_GCSRS */ 
     
    91721GCSysCoord GCSRSAPI_CALL1(*) OGRSpatialReference2SysCoord_GCSRS ( OGRSpatialReferenceH