TransWikia.com

Reconstruct full coordinate reference system stored in a GML file

Geographic Information Systems Asked by Rho Phi on February 18, 2021

I have been able to parse a GML file and fetch the polygons I wanted. They can be plotted ok when plotted on their own. I have them stored in a
GeoPandas data frame, but I am struggling to set the proper CRS to be able to use this data along with other data frames in a consistent manner.

Each feature is like this

<omi:OMIFeature>
<omi:title>MyTitle</omi:title>
<omi:description>Descr</omi:description>
<omi:linkzona></omi:linkzona>
<gml:MultiSurface srsName="GEOPOIUTM32.5" srsDimension="2">
<gml:surfaceMember>
<gml:Polygon>
<gml:exterior>
<gml:LinearRing>
<gml:pos>520381.7 4648450.2</gml:pos>
<gml:pos>520435.9 4648293.8</gml:pos>
<gml:pos>520450.9 4648243.6</gml:pos>
... more positions like this

The specification of the CRS seems to be a custom one named GEOPOIUTM32.5

I did find a dictionary that seems to describe in full this coordinates reference system, but I am afraid I am not able to use this info. What info should I pick here and use it to set the CRS of this data frame with set_crs()? (I have tried 6402, 7030,4326 as EPSG but they give oddly placed results or not plot anything at all. I figured that 32633 gives x coordinate off by a huge amount, but y is nearly right).

<gml:Dictionary gml:id="OMI_Dictionary">
    <gml:description>Dictionary description</gml:description>
    <gml:name>Dictionary name</gml:name>
    <gml:dictionaryEntry>
        <gml:ProjectedCRS gml:id="ogrcrs104">
            <gml:srsName>GEOPOI / UTM zone 32.5</gml:srsName>
            <gml:srsID>
                <gml:name>GEOPOIUTM32.5</gml:name>
            </gml:srsID>
            <gml:baseCRS>
                <gml:GeographicCRS gml:id="ogrcrs105">
                    <gml:srsName>WGS 84</gml:srsName>
                    <gml:srsID>
                        <gml:name>4326</gml:name>
                    </gml:srsID>
                    <gml:usesEllipsoidalCS>
                        <gml:EllipsoidalCS gml:id="ogrcrs106">
                            <gml:csName>ellipsoidal</gml:csName>
                            <gml:csID>
                                <gml:name>6402</gml:name>
                            </gml:csID>
                            <gml:usesAxis>
                                <gml:CoordinateSystemAxis gml:id="ogrcrs107" gml:uom="urn:ogc:def:uom:EPSG::9102">
                                    <gml:name>Geodetic latitude</gml:name>
                                    <gml:axisID>
                                        <gml:name>9901</gml:name>
                                    </gml:axisID>
                                    <gml:axisAbbrev>Lat</gml:axisAbbrev>
                                    <gml:axisDirection>north</gml:axisDirection>
                                </gml:CoordinateSystemAxis>
                            </gml:usesAxis>
                            <gml:usesAxis>
                                <gml:CoordinateSystemAxis gml:id="ogrcrs108" gml:uom="urn:ogc:def:uom:EPSG::9102">
                                    <gml:name>Geodetic longitude</gml:name>
                                    <gml:axisID>
                                        <gml:name>9902</gml:name>
                                    </gml:axisID>
                                    <gml:axisAbbrev>Lon</gml:axisAbbrev>
                                    <gml:axisDirection>east</gml:axisDirection>
                                </gml:CoordinateSystemAxis>
                            </gml:usesAxis>
                        </gml:EllipsoidalCS>
                    </gml:usesEllipsoidalCS>
                    <gml:usesGeodeticDatum>
                        <gml:GeodeticDatum gml:id="ogrcrs109">
                            <gml:datumName>WGS_1984</gml:datumName>
                            <gml:datumID>
                                <gml:name>6326</gml:name>
                            </gml:datumID>
                            <gml:usesPrimeMeridian>
                                <gml:PrimeMeridian gml:id="ogrcrs110">
                                    <gml:meridianName>Greenwich</gml:meridianName>
                                    <gml:meridianID>
                                        <gml:name>8901</gml:name>
                                    </gml:meridianID>
                                    <gml:greenwichLongitude>
                                        <gml:angle uom="urn:ogc:def:uom:EPSG::9102">0</gml:angle>
                                    </gml:greenwichLongitude>
                                </gml:PrimeMeridian>
                            </gml:usesPrimeMeridian>
                            <gml:usesEllipsoid>
                                <gml:Ellipsoid gml:id="ogrcrs111">
                                    <gml:ellipsoidName>WGS 84</gml:ellipsoidName>
                                    <gml:ellipsoidID>
                                        <gml:name>7030</gml:name>
                                    </gml:ellipsoidID>
                                    <gml:semiMajorAxis uom="urn:ogc:def:uom:EPSG::9001">6378137</gml:semiMajorAxis>
                                    <gml:secondDefiningParameter>
                                        <gml:inverseFlattening uom="urn:ogc:def:uom:EPSG::9201">298.257223563</gml:inverseFlattening>
                                    </gml:secondDefiningParameter>
                                </gml:Ellipsoid>
                            </gml:usesEllipsoid>
                        </gml:GeodeticDatum>
                    </gml:usesGeodeticDatum>
                </gml:GeographicCRS>
            </gml:baseCRS>
            <gml:definedByConversion>
                <gml:Conversion gml:id="ogrcrs112">
                    <gml:coordinateOperationName></gml:coordinateOperationName>
                    <gml:usesMethod xlink:href="urn:ogc:def:method:EPSG::9807"/>
                    <gml:usesValue>
                        <gml:value uom="urn:ogc:def:uom:EPSG::9102">0</gml:value>
                        <gml:valueOfParameter xlink:href="urn:ogc:def:parameter:EPSG::8801"/>
                    </gml:usesValue>
                    <gml:usesValue>
                        <gml:value uom="urn:ogc:def:uom:EPSG::9102">12</gml:value>
                        <gml:valueOfParameter xlink:href="urn:ogc:def:parameter:EPSG::8802"/>
                    </gml:usesValue>
                    <gml:usesValue>
                        <gml:value uom="urn:ogc:def:uom:EPSG::9001">0.9996</gml:value>
                        <gml:valueOfParameter xlink:href="urn:ogc:def:parameter:EPSG::8805"/>
                    </gml:usesValue>
                    <gml:usesValue>
                        <gml:value uom="urn:ogc:def:uom:EPSG::9001">500000</gml:value>
                        <gml:valueOfParameter xlink:href="urn:ogc:def:parameter:EPSG::8806"/>
                    </gml:usesValue>
                    <gml:usesValue>
                        <gml:value uom="urn:ogc:def:uom:EPSG::9001">0</gml:value>
                        <gml:valueOfParameter xlink:href="urn:ogc:def:parameter:EPSG::8807"/>
                    </gml:usesValue>
                </gml:Conversion>
            </gml:definedByConversion>
            <gml:usesCartesianCS>
                <gml:CartesianCS gml:id="ogrcrs113">
                    <gml:csName>Cartesian</gml:csName>
                    <gml:csID>
                        <gml:name>4400</gml:name>
                    </gml:csID>
                    <gml:usesAxis>
                        <gml:CoordinateSystemAxis gml:id="ogrcrs114" gml:uom="urn:ogc:def:uom:EPSG::9001">
                            <gml:name>Easting</gml:name>
                            <gml:axisID>
                                <gml:name>9906</gml:name>
                            </gml:axisID>
                            <gml:axisAbbrev>E</gml:axisAbbrev>
                            <gml:axisDirection>east</gml:axisDirection>
                        </gml:CoordinateSystemAxis>
                    </gml:usesAxis>
                    <gml:usesAxis>
                        <gml:CoordinateSystemAxis gml:id="ogrcrs115" gml:uom="urn:ogc:def:uom:EPSG::9001">
                            <gml:name>Northing</gml:name>
                            <gml:axisID>
                                <gml:name>9907</gml:name>
                            </gml:axisID>
                            <gml:axisAbbrev>N</gml:axisAbbrev>
                            <gml:axisDirection>north</gml:axisDirection>
                        </gml:CoordinateSystemAxis>
                    </gml:usesAxis>
                </gml:CartesianCS>
            </gml:usesCartesianCS>
        </gml:ProjectedCRS>
    </gml:dictionaryEntry>
</gml:Dictionary>

One Answer

The CRS described in your file has essentially the same definition as UTM, but with the central meridian at 12, halfway between zones 32 and 33. So one possible solution is to build a custom string, like a proj string:

+proj=tmerc +lat_0=0 +lon_0=12 +k=0.9996 +x_0=500000 +y_0=0 +datum=WGS84 +units=m +no_defs 

and set this as the CRS of the layer.

Or with a WKT, take any one of the WGS84 UTM Zones' WKT and change the central_meridian to 12 and adapt the WKT:

PROJCS["WGS 84 / UTM zone 32.5",
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]],
PROJECTION["Transverse_Mercator"],
PARAMETER["latitude_of_origin",0],
PARAMETER["central_meridian",12],
PARAMETER["scale_factor",0.9996],
PARAMETER["false_easting",500000],
PARAMETER["false_northing",0],
UNIT["metre",1,
    AUTHORITY["EPSG","9001"]],
AXIS["Easting",EAST],
AXIS["Northing",NORTH]]

The meaning of the EPSG codes for the different parameters can be verified on epsg.org by searching for the code and choosing the appropriate tab corresponding to the category of the parameter in question.

Correct answer by FSimardGIS on February 18, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP