📄 mitab_spatialref.cpp
字号:
/********************************************************************** * $Id: mitab_spatialref.cpp,v 1.47 2006/07/10 17:58:48 fwarmerdam Exp $ * * Name: mitab_spatialref.cpp * Project: MapInfo TAB Read/Write library * Language: C++ * Purpose: Implementation of the SpatialRef stuff in the TABFile class. * Author: Frank Warmerdam, warmerdam@pobox.com * ********************************************************************** * Copyright (c) 1999-2001, Frank Warmerdam * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ********************************************************************** * * $Log: mitab_spatialref.cpp,v $ * Revision 1.47 2006/07/10 17:58:48 fwarmerdam * North_American_Datum_1927 support * * Revision 1.46 2006/07/07 19:41:32 dmorissette * Fixed problem with uninitialized sTABProj.nAffineFlag (bug 1254,1319) * * Revision 1.45 2006/05/09 20:21:29 fwarmerdam * Coordsys false easting and northing are in the units of the coordsys, not * necessarily meters. Adjusted mitab_spatialref.cpp to reflect this. * http://bugzilla.remotesensing.org/show_bug.cgi?id=1113 * * Revision 1.44 2005/09/29 20:15:36 dmorissette * More improvements to handling of modified TM projections 21-24. * Added correct name stings to all datum definitions (Anthony D, bug 1155) * * Revision 1.43 2005/05/12 22:07:52 dmorissette * Improved handling of Danish modified TM proj#21-24 (hss, bugs 976,1010) * * Revision 1.42 2005/03/22 23:24:54 dmorissette * Added support for datum id in .MAP header (bug 910) * * Revision 1.41 2004/10/11 20:50:04 dmorissette * 7 new datum defns, 1 fixed and list of ellipsoids updated (Bug 608,Uffe K.) * * Revision 1.40 2003/03/21 14:20:42 warmerda * fixed up regional mercator handling, was screwing up transverse mercator * * Revision 1.39 2002/12/19 20:46:01 warmerda * fixed spelling of Provisional_South_American_Datum_1956 * * Revision 1.38 2002/12/12 20:12:18 warmerda * fixed signs of rotational parameters for TOWGS84 in WKT * * Revision 1.37 2002/10/15 14:33:30 warmerda * Added untested support in mitab_spatialref.cpp, and mitab_coordsys.cpp for * projections Regional Mercator (26), Polyconic (27), Azimuthal Equidistant - * All origin latitudes (28), and Lambert Azimuthal Equal Area - any aspect * (29). * * Revision 1.36 2002/09/05 15:38:16 warmerda * one more ogc datum name * * Revision 1.35 2002/09/05 15:23:22 warmerda * added some EPSG datum names provided by Siro Martello @ Cadcorp * * Revision 1.34 2002/04/01 19:49:24 warmerda * added support for cassini/soldner - proj 30 * * Revision 1.33 2002/03/01 19:00:15 warmerda * False Easting/Northing should be in the linear units of measure in MapInfo, * but in OGRSpatialReference/WKT they are always in meters. Convert accordingly. * * Revision 1.32 2001/10/25 16:13:41 warmerda * Added OGC string for datum 12 * * Revision 1.31 2001/08/10 21:25:59 warmerda * SetSpatialRef() now makes a clone of the srs instead of taking a ref to it * * Revision 1.30 2001/04/23 17:38:06 warmerda * fixed use of freed points bug for datum 999/9999 * * Revision 1.29 2001/04/04 21:43:19 warmerda * added code to set WGS84 values * * Revision 1.28 2001/01/23 21:23:42 daniel * Added projection bounds lookup table, called from TABFile::SetProjInfo() * * Revision 1.27 2001/01/22 16:00:53 warmerda * reworked swiss projection support * * Revision 1.26 2001/01/19 21:56:18 warmerda * added untested support for Swiss Oblique Mercator * * Revision 1.25 2000/12/05 14:56:55 daniel * Added some missing unit names (aliases) in TABFile::SetSpatialRef() * * Revision 1.24 2000/10/16 21:44:50 warmerda * added nonearth support * * Revision 1.23 2000/10/16 18:01:20 warmerda * added check for NULL on passed in spatial ref * * Revision 1.22 2000/10/02 14:46:36 daniel * Added 7 parameter datums with id 1000+ * * Revision 1.21 2000/09/29 22:09:18 daniel * Added new datums/ellipsoid from MapInfo V6.0 * * Revision 1.20 2000/09/28 16:39:44 warmerda * avoid warnings for unused, and unitialized variables * * Revision 1.19 2000/02/07 17:43:17 daniel * Fixed offset in parsing of custom datum string in SetSpatialRef() * * Revision 1.18 2000/02/04 05:30:50 daniel * Fixed problem in GetSpatialRef() with szDatumName[] buffer size and added * use of an epsilon in comparing of datum parameters. * * Revision 1.17 2000/01/15 22:30:45 daniel * Switch to MIT/X-Consortium OpenSource license * * Revision 1.16 1999/12/21 20:01:47 warmerda * added support for DATUM 0 * * Revision 1.15 1999/11/11 02:56:17 warmerda * fixed problems with stereographic * * Revision 1.14 1999/11/10 20:13:12 warmerda * implement spheroid table * * Revision 1.13 1999/11/09 22:31:38 warmerda * initial implementation of MIF CoordSys support * * Revision 1.12 1999/10/19 16:31:32 warmerda * Improved mile support. * * Revision 1.11 1999/10/19 16:27:50 warmerda * Added support for Mile (units=0). Also added support for nonearth * projections. * * Revision 1.10 1999/10/05 18:56:08 warmerda * fixed lots of bugs with projection parameters * * Revision 1.9 1999/10/04 21:17:47 warmerda * Make sure that asDatumInfoList comparisons include the ellipsoid code. * Don't include OGC name for local NAD27 values. Put NAD83 ahead of GRS80 * so it will be used in preference even though they are identical parms. * * Revision 1.8 1999/10/04 19:46:42 warmerda * assorted changes, including rework of units * * Revision 1.7 1999/09/28 04:52:17 daniel * Added missing param in sprintf() format for szDatumName[] * * Revision 1.6 1999/09/28 02:51:46 warmerda * Added ellipsoid codes, and bulk of write implementation. * * Revision 1.5 1999/09/27 21:23:41 warmerda * added more projections * * Revision 1.4 1999/09/24 04:01:28 warmerda * remember nMIDatumId changes * * Revision 1.3 1999/09/23 19:51:38 warmerda * added datum mapping table support * * Revision 1.2 1999/09/22 23:04:59 daniel * Handle reference count on OGRSpatialReference properly * * Revision 1.1 1999/09/21 19:39:22 daniel * Moved Get/SetSpatialRef() to a separate file * **********************************************************************/#include "mitab.h"/* -------------------------------------------------------------------- *//* This table was automatically generated by doing translations *//* between mif and tab for each datum, and extracting the *//* parameters from the tab file. The OGC names were added *//* afterwards and may be incomplete or inaccurate. *//* -------------------------------------------------------------------- */MapInfoDatumInfo asDatumInfoList[] ={{104, "WGS_1984", 28,0, 0, 0, 0, 0, 0, 0, 0},{74, "North_American_Datum_1983", 0, 0, 0, 0, 0, 0, 0, 0, 0},{0, "", 29, 0, 0, 0, 0, 0, 0, 0, 0}, // Datum ignore{1, "Adindan", 6, -162, -12, 206, 0, 0, 0, 0, 0},{2, "Afgooye", 3, -43, -163, 45, 0, 0, 0, 0, 0},{3, "Ain_el_Abd_1970", 4, -150, -251, -2, 0, 0, 0, 0, 0},{4, "Anna_1_Astro_1965", 2, -491, -22, 435, 0, 0, 0, 0, 0},{5, "Arc_1950", 15,-143, -90, -294,0, 0, 0, 0, 0},{6, "Arc_1960", 6, -160, -8, -300,0, 0, 0, 0, 0},{7, "Ascension_Islands", 4, -207, 107, 52, 0, 0, 0, 0, 0},{8, "Astro_Beacon_E", 4, 145, 75, -272,0, 0, 0, 0, 0},{9, "Astro_B4_Sorol_Atoll", 4, 114, -116, -333,0, 0, 0, 0, 0},{10, "Astro_Dos_71_4", 4, -320, 550, -494,0, 0, 0, 0, 0},{11, "Astronomic_Station_1952", 4, 124, -234, -25, 0, 0, 0, 0, 0},{12, "Australian_Geodetic_Datum_66",2, -133, -48, 148, 0, 0, 0, 0, 0},{13, "Australian_Geodetic_Datum_84",2, -134, -48, 149, 0, 0, 0, 0, 0},{14, "Bellevue_Ign", 4, -127, -769, 472, 0, 0, 0, 0, 0},{15, "Bermuda_1957", 7, -73, 213, 296, 0, 0, 0, 0, 0},{16, "Bogota", 4, 307, 304, -318,0, 0, 0, 0, 0},{17, "Campo_Inchauspe", 4, -148, 136, 90, 0, 0, 0, 0, 0},{18, "Canton_Astro_1966", 4, 298, -304, -375,0, 0, 0, 0, 0},{19, "Cape", 6, -136, -108, -292,0, 0, 0, 0, 0},{20, "Cape_Canaveral", 7, -2, 150, 181, 0, 0, 0, 0, 0},{21, "Carthage", 6, -263, 6, 431, 0, 0, 0, 0, 0},{22, "Chatham_1971", 4, 175, -38, 113, 0, 0, 0, 0, 0},{23, "Chua", 4, -134, 229, -29, 0, 0, 0, 0, 0},{24, "Corrego_Alegre", 4, -206, 172, -6, 0, 0, 0, 0, 0},{25, "Batavia", 10,-377,681, -50, 0, 0, 0, 0, 0},{26, "Dos_1968", 4, 230, -199, -752,0, 0, 0, 0, 0},{27, "Easter_Island_1967", 4, 211, 147, 111, 0, 0, 0, 0, 0},{28, "European_Datum_1950", 4, -87, -98, -121,0, 0, 0, 0, 0},{29, "European_Datum_1979", 4, -86, -98, -119,0, 0, 0, 0, 0},{30, "Gandajika_1970", 4, -133, -321, 50, 0, 0, 0, 0, 0},{31, "New_Zealand_GD49", 4, 84, -22, 209, 0, 0, 0, 0, 0},{32, "GRS_67", 21,0, 0, 0, 0, 0, 0, 0, 0},{33, "GRS_80", 0, 0, 0, 0, 0, 0, 0, 0, 0},{34, "Guam_1963", 7, -100, -248, 259, 0, 0, 0, 0, 0},{35, "Gux_1_Astro", 4, 252, -209, -751,0, 0, 0, 0, 0},{36, "Hito_XVIII_1963", 4, 16, 196, 93, 0, 0, 0, 0, 0},{37, "Hjorsey_1955", 4, -73, 46, -86, 0, 0, 0, 0, 0},{38, "Hong_Kong_1963", 4, -156, -271, -189,0, 0, 0, 0, 0},{39, "Hu_Tzu_Shan", 4, -634, -549, -201,0, 0, 0, 0, 0},{40, "Indian_Thailand_Vietnam", 11,214, 836, 303, 0, 0, 0, 0, 0},{41, "Indian_Bangladesh", 11,289, 734, 257, 0, 0, 0, 0, 0},{42, "Ireland_1965", 13,506, -122, 611, 0, 0, 0, 0, 0},{43, "ISTS_073_Astro_1969", 4, 208, -435, -229,0, 0, 0, 0, 0},{44, "Johnston_Island_1961", 4, 191, -77, -204,0, 0, 0, 0, 0},{45, "Kandawala", 11,-97, 787, 86, 0, 0, 0, 0, 0},{46, "Kerguyelen_Island", 4, 145, -187, 103, 0, 0, 0, 0, 0},{47, "Kertau", 17,-11, 851, 5, 0, 0, 0, 0, 0},{48, "L_C_5_Astro", 7, 42, 124, 147, 0, 0, 0, 0, 0},{49, "Liberia_1964", 6, -90, 40, 88, 0, 0, 0, 0, 0},{50, "Luzon_Phillippines", 7, -133, -77, -51, 0, 0, 0, 0, 0},{51, "Luzon_Mindanao_Island", 7, -133, -79, -72, 0, 0, 0, 0, 0},{52, "Mahe_1971", 6, 41, -220, -134,0, 0, 0, 0, 0},{53, "Marco_Astro", 4, -289, -124, 60, 0, 0, 0, 0, 0},{54, "Massawa", 10,639, 405, 60, 0, 0, 0, 0, 0},{55, "Merchich", 16,31, 146, 47, 0, 0, 0, 0, 0},{56, "Midway_Astro_1961", 4, 912, -58, 1227,0, 0, 0, 0, 0},{57, "Minna", 6, -92, -93, 122, 0, 0, 0, 0, 0},{58, "Nahrwan_Masirah_Island", 6, -247, -148, 369, 0, 0, 0, 0, 0},{59, "Nahrwan_Un_Arab_Emirates", 6, -249, -156, 381, 0, 0, 0, 0, 0},{60, "Nahrwan_Saudi_Arabia", 6, -231, -196, 482, 0, 0, 0, 0, 0},{61, "Naparima_1972", 4, -2, 374, 172, 0, 0, 0, 0, 0},{62, "NAD_1927", 7, -8, 160, 176, 0, 0, 0, 0, 0},{62, "North_American_Datum_1927", 7, -8, 160, 176, 0, 0, 0, 0, 0},{63, "NAD_27_Alaska", 7, -5, 135, 172, 0, 0, 0, 0, 0},{64, "NAD_27_Bahamas", 7, -4, 154, 178, 0, 0, 0, 0, 0},{65, "NAD_27_San_Salvador", 7, 1, 140, 165, 0, 0, 0, 0, 0},{66, "NAD_27_Canada", 7, -10, 158, 187, 0, 0, 0, 0, 0},{67, "NAD_27_Canal_Zone", 7, 0, 125, 201, 0, 0, 0, 0, 0},{68, "NAD_27_Caribbean", 7, -7, 152, 178, 0, 0, 0, 0, 0},{69, "NAD_27_Central_America", 7, 0, 125, 194, 0, 0, 0, 0, 0},{70, "NAD_27_Cuba", 7, -9, 152, 178, 0, 0, 0, 0, 0},{71, "NAD_27_Greenland", 7, 11, 114, 195, 0, 0, 0, 0, 0},{72, "NAD_27_Mexico", 7, -12, 130, 190, 0, 0, 0, 0, 0},{73, "NAD_27_Michigan", 8, -8, 160, 176, 0, 0, 0, 0, 0},{75, "Observatorio_1966", 4, -425, -169, 81, 0, 0, 0, 0, 0},{76, "Old_Egyptian", 22,-130, 110, -13, 0, 0, 0, 0, 0},{77, "Old_Hawaiian", 7, 61, -285, -181,0, 0, 0, 0, 0},{78, "Oman", 6, -346, -1, 224, 0, 0, 0, 0, 0},{79, "OSGB_1936", 9, 375, -111, 431, 0, 0, 0, 0, 0},{80, "Pico_De_Las_Nieves", 4, -307, -92, 127, 0, 0, 0, 0, 0},{81, "Pitcairn_Astro_1967", 4, 185, 165, 42, 0, 0, 0, 0, 0},{82, "Provisional_South_American", 4, -288, 175, -376,0, 0, 0, 0, 0},{83, "Puerto_Rico", 7, 11, 72, -101,0, 0, 0, 0, 0},{84, "Qatar_National", 4, -128, -283, 22, 0, 0, 0, 0, 0},{85, "Qornoq", 4, 164, 138, -189, 0, 0, 0, 0, 0},{86, "Reunion", 4, 94, -948,-1262,0, 0, 0, 0, 0},{87, "Monte_Mario", 4, -225, -65, 9, 0, 0, 0, 0, 0},{88, "Santo_Dos", 4, 170, 42, 84, 0, 0, 0, 0, 0},
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -