⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mitab_spatialref.cpp

📁 GIS系统支持库Geospatial Data Abstraction Library代码.GDAL is a translator library for raster geospatial dat
💻 CPP
📖 第 1 页 / 共 4 页
字号:
MapInfoSpheroidInfo asSpheroidInfoList[] ={{ 9,"Airy 1930",                                6377563.396,    299.3249646},{13,"Airy 1930 (modified for Ireland 1965",     6377340.189,    299.3249646},{51,"ATS77 (Average Terrestrial System 1977)",  6378135,        298.257},{ 2,"Australian",                               6378160.0,      298.25},{10,"Bessel 1841",                              6377397.155,    299.1528128},{35,"Bessel 1841 (modified for NGO 1948)",      6377492.0176,   299.15281},{14,"Bessel 1841 (modified for Schwarzeck)",    6377483.865,    299.1528128},{36,"Clarke 1858",                              6378293.639,    294.26068},{ 7,"Clarke 1866",                              6378206.4,      294.9786982},{ 8,"Clarke 1866 (modified for Michigan)",      6378450.047484481,294.9786982},{ 6,"Clarke 1880",                              6378249.145,    293.465},{15,"Clarke 1880 (modified for Arc 1950)",      6378249.145326, 293.4663076},{30,"Clarke 1880 (modified for IGN)",           6378249.2,      293.4660213},{37,"Clarke 1880 (modified for Jamaica)",       6378249.136,    293.46631},{16,"Clarke 1880 (modified for Merchich)",      6378249.2,      293.46598},{38,"Clarke 1880 (modified for Palestine)",     6378300.79,     293.46623},{39,"Everest (Brunei and East Malaysia)",       6377298.556,    300.8017},{11,"Everest (India 1830)",                     6377276.345,    300.8017},{40,"Everest (India 1956)",                     6377301.243,    300.80174},{50,"Everest (Pakistan)",                       6377309.613,    300.8017},{17,"Everest (W. Malaysia and Singapore 1948)", 6377304.063,    300.8017},{48,"Everest (West Malaysia 1969)",             6377304.063,    300.8017},{18,"Fischer 1960",                             6378166.0,      298.3},{19,"Fischer 1960 (modified for South Asia)",   6378155.0,      298.3},{20,"Fischer 1968",                             6378150.0,      298.3},{21,"GRS 67",                                   6378160.0,      298.247167427},{ 0,"GRS 80",                                   6378137.0,      298.257222101},{ 5,"Hayford",                                  6378388.0,      297.0},{22,"Helmert 1906",                             6378200.0,      298.3},{23,"Hough",                                    6378270.0,      297.0},{31,"IAG 75",                                   6378140.0,      298.257222},{41,"Indonesian",                               6378160.0,      298.247},{ 4,"International 1924",                       6378388.0,      297.0},{49,"Irish (WOFO)",                             6377542.178,    299.325},{ 3,"Krassovsky",                               6378245.0,      298.3},{32,"MERIT 83",                                 6378137.0,      298.257},{33,"New International 1967",                   6378157.5,      298.25},{42,"NWL 9D",                                   6378145.0,      298.25},{43,"NWL 10D",                                  6378135.0,      298.26},{44,"OSU86F",                                   6378136.2,      298.25722},{45,"OSU91A",                                   6378136.3,      298.25722},{46,"Plessis 1817",                             6376523.0,      308.64},{52,"PZ90",                                     6378136.0,      298.257839303},{24,"South American",                           6378160.0,      298.25},{12,"Sphere",                                   6370997.0,      0.0},{47,"Struve 1860",                              6378297.0,      294.73},{34,"Walbeck",                                  6376896.0,      302.78},{25,"War Office",                               6378300.583,    296.0},{26,"WGS 60",                                   6378165.0,      298.3},{27,"WGS 66",                                   6378145.0,      298.25},{ 1,"WGS 72",                                   6378135.0,      298.26},{28,"WGS 84",                                   6378137.0,      298.257223563},{29,"WGS 84 (MAPINFO Datum 0)",                 6378137.01,     298.257223563},{-1,NULL,                                       0.0,            0.0}}; /********************************************************************** *                   TABFile::GetSpatialRef() * * Returns a reference to an OGRSpatialReference for this dataset. * If the projection parameters have not been parsed yet, then we will * parse them before returning. * * The returned object is owned and maintained by this TABFile and * should not be modified or freed by the caller. * * Returns NULL if the SpatialRef cannot be accessed. **********************************************************************/OGRSpatialReference *TABFile::GetSpatialRef(){    if (m_eAccessMode != TABRead)    {        CPLError(CE_Failure, CPLE_NotSupported,                 "GetSpatialRef() can be used only with Read access.");        return NULL;    }     if (m_poMAPFile == NULL )    {        CPLError(CE_Failure, CPLE_AssertionFailed,                 "GetSpatialRef() failed: file has not been opened yet.");        return NULL;    }    /*-----------------------------------------------------------------     * If projection params have already been processed, just use them.     *----------------------------------------------------------------*/    if (m_poSpatialRef != NULL)        return m_poSpatialRef;        /*-----------------------------------------------------------------     * Fetch the parameters from the header.     *----------------------------------------------------------------*/    TABMAPHeaderBlock *poHeader;    TABProjInfo     sTABProj;    if ((poHeader = m_poMAPFile->GetHeaderBlock()) == NULL ||        poHeader->GetProjInfo( &sTABProj ) != 0)    {        CPLError(CE_Failure, CPLE_FileIO,                 "GetSpatialRef() failed reading projection parameters.");        return NULL;    }    /*-----------------------------------------------------------------     * Get the units name, and translation factor.     *----------------------------------------------------------------*/    const char *pszUnitsName;     const char *pszUnitsConv;    double      dfConv = 1.0;    switch( sTABProj.nUnitsId )    {      case 0:        pszUnitsName = "Mile";        pszUnitsConv = "1609.344";        break;      case 1:        pszUnitsName = "Kilometer";        pszUnitsConv = "1000.0";        break;                  case 2:        pszUnitsName = "IINCH";        pszUnitsConv = "0.0254";        break;                  case 3:        pszUnitsName = SRS_UL_FOOT;        pszUnitsConv = SRS_UL_FOOT_CONV;        break;                  case 4:        pszUnitsName = "IYARD";        pszUnitsConv = "0.9144";        break;                  case 5:        pszUnitsName = "Millimeter";        pszUnitsConv = "0.001";        break;                  case 6:        pszUnitsName = "Centimeter";        pszUnitsConv = "0.01";        break;                  case 7:        pszUnitsName = SRS_UL_METER;        pszUnitsConv = "1.0";        break;                  case 8:        pszUnitsName = SRS_UL_US_FOOT;        pszUnitsConv = SRS_UL_US_FOOT_CONV;        break;                  case 9:        pszUnitsName = SRS_UL_NAUTICAL_MILE;        pszUnitsConv = SRS_UL_NAUTICAL_MILE_CONV;        break;                  case 30:        pszUnitsName = SRS_UL_LINK;        pszUnitsConv = SRS_UL_LINK_CONV;        break;                  case 31:        pszUnitsName = SRS_UL_CHAIN;        pszUnitsConv = SRS_UL_CHAIN_CONV;        break;                  case 32:        pszUnitsName = SRS_UL_ROD;        pszUnitsConv = SRS_UL_ROD_CONV;        break;                  default:        pszUnitsName = SRS_UL_METER;        pszUnitsConv = "1.0";        break;    }    dfConv = atof(pszUnitsConv);    /*-----------------------------------------------------------------     * Transform them into an OGRSpatialReference.     *----------------------------------------------------------------*/    m_poSpatialRef = new OGRSpatialReference;    /*-----------------------------------------------------------------     * Handle the PROJCS style projections, but add the datum later.     *----------------------------------------------------------------*/    switch( sTABProj.nProjId )    {        /*--------------------------------------------------------------         * NonEarth ... we return with an empty SpatialRef.  Eventually         * we might want to include the units, but not for now.         *-------------------------------------------------------------*/      case 0:        m_poSpatialRef->SetLocalCS( "Nonearth" );        break;        /*--------------------------------------------------------------         * lat/long .. just add the GEOGCS later.         *-------------------------------------------------------------*/      case 1:        break;        /*--------------------------------------------------------------         * Cylindrical Equal Area         *-------------------------------------------------------------*/      case 2:        m_poSpatialRef->SetCEA( sTABProj.adProjParams[1],                                sTABProj.adProjParams[0],                                sTABProj.adProjParams[2] * dfConv,                                sTABProj.adProjParams[3] * dfConv );        break;        /*--------------------------------------------------------------         * Lambert Conic Conformal         *-------------------------------------------------------------*/      case 3:        m_poSpatialRef->SetLCC( sTABProj.adProjParams[2],                                sTABProj.adProjParams[3],                                sTABProj.adProjParams[1],                                sTABProj.adProjParams[0],                                sTABProj.adProjParams[4] * dfConv,                                sTABProj.adProjParams[5] * dfConv );        break;        /*--------------------------------------------------------------         * Lambert Azimuthal Equal Area         *-------------------------------------------------------------*/      case 4:      case 29:        m_poSpatialRef->SetLAEA( sTABProj.adProjParams[1],                                 sTABProj.adProjParams[0],                                 0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Azimuthal Equidistant (Polar aspect only)         *-------------------------------------------------------------*/      case 5:      case 28:        m_poSpatialRef->SetAE( sTABProj.adProjParams[1],                               sTABProj.adProjParams[0],                               0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Equidistant Conic         *-------------------------------------------------------------*/      case 6:        m_poSpatialRef->SetEC( sTABProj.adProjParams[2],                               sTABProj.adProjParams[3],                               sTABProj.adProjParams[1],                               sTABProj.adProjParams[0],                               sTABProj.adProjParams[4] * dfConv,                               sTABProj.adProjParams[5] * dfConv );        break;        /*--------------------------------------------------------------         * Hotine Oblique Mercator         *-------------------------------------------------------------*/      case 7:        m_poSpatialRef->SetHOM( sTABProj.adProjParams[1],                                sTABProj.adProjParams[0],                                 sTABProj.adProjParams[2],                                90.0,                                 sTABProj.adProjParams[3],                                sTABProj.adProjParams[4] * dfConv,                                sTABProj.adProjParams[5] * dfConv );        break;        /*--------------------------------------------------------------         * Transverse Mercator         *-------------------------------------------------------------*/      case 8:      case 21:      case 22:      case 23:      case 24:        m_poSpatialRef->SetTM( sTABProj.adProjParams[1],                               sTABProj.adProjParams[0],                               sTABProj.adProjParams[2],                               sTABProj.adProjParams[3] * dfConv,                               sTABProj.adProjParams[4] * dfConv );        break;        /*--------------------------------------------------------------         * Albers Conic Equal Area         *-------------------------------------------------------------*/      case 9:        m_poSpatialRef->SetACEA( sTABProj.adProjParams[2],                                 sTABProj.adProjParams[3],                                 sTABProj.adProjParams[1],                                 sTABProj.adProjParams[0],                                 sTABProj.adProjParams[4] * dfConv,                                 sTABProj.adProjParams[5] * dfConv );        break;        /*--------------------------------------------------------------         * Mercator         *-------------------------------------------------------------*/      case 10:        m_poSpatialRef->SetMercator( 0.0, sTABProj.adProjParams[0],                                     1.0, 0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Miller Cylindrical         *-------------------------------------------------------------*/      case 11:        m_poSpatialRef->SetMC( 0.0, sTABProj.adProjParams[0],                               0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Robinson         *-------------------------------------------------------------*/      case 12:        m_poSpatialRef->SetRobinson( sTABProj.adProjParams[0],                                     0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Mollweide         *-------------------------------------------------------------*/      case 13:        m_poSpatialRef->SetMollweide( sTABProj.adProjParams[0],                                      0.0, 0.0 );        /*--------------------------------------------------------------         * Eckert IV         *-------------------------------------------------------------*/      case 14:        m_poSpatialRef->SetEckertIV( sTABProj.adProjParams[0], 0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Eckert VI         *-------------------------------------------------------------*/      case 15:        m_poSpatialRef->SetEckertVI( sTABProj.adProjParams[0], 0.0, 0.0 );        break;        /*--------------------------------------------------------------         * Sinusoidal

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -