Geographic Information Systems Asked on October 2, 2021
I’m going to convert coordinates in a gml file. Inside the file says <gml:Envelope srsName="urn:ogc:def:crs:EPSG::3347" srsDimension="2">
so I think the coordinate system is EPSG:3347. (The first lines of file shows in the end of this question)
I tried to convert the first coordinate by a Python code to Google coordinate, but I didn’t get the correct coordinate. (my coordinate was 8979444.20611001,2148774.86356001 for St. John’s South–Mount Pearl in Canada.)
Python code to convert
>>> from pyproj import Proj, transform
>>> inProj = Proj("+init=EPSG:3347")
>>> outProj = Proj("+init=EPSG:4326") # I believe google use this coordinate system
>>> x, y = 8979444.20611001, 2148774.86356001
>>> print(transform(inProj,outProj,x,y))
(-52.746286073488385, 47.53880067785412)
I expect the result to be something like 47.525712,-53.0941826 since when I searched google for that area on the map I got this URL and inside the URL Google used those numbers
https://www.google.com/maps/search/St.+John’s+South–Mount+Pearl/@47.525712,-53.0941826,10z
==========================================================================
The first lines of gml file which show the coordinate system and first coordinate which I tested by the Python program.
<?xml version="1.0" encoding="UTF-8"?>
<gml:FeatureCollection xmlns:fme="http://www.safe.com/gml/fme" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xsi:schemaLocation="http://www.safe.com/gml/fme ldb_000b16g_e.xsd">
<gml:boundedBy>
<gml:Envelope srsName="urn:ogc:def:crs:EPSG::3347" srsDimension="2">
<gml:lowerCorner>3689439.01142991 659338.860003093</gml:lowerCorner>
<gml:upperCorner>9015736.63142905 5242179.21714491</gml:upperCorner>
</gml:Envelope>
</gml:boundedBy>
<gml:featureMember>
<fme:ldb_000b16g_e gml:id="id06314a49-5d76-4da4-a503-61389e1de9f2">
<fme:DBUID>10010202002</fme:DBUID>
<fme:DBRPLAMX>8979444.20611001</fme:DBRPLAMX>
<fme:DBRPLAMY>2148774.86356001</fme:DBRPLAMY>
<fme:PRUID>10</fme:PRUID>
<fme:PRNAME>Newfoundland and Labrador / Terre-Neuve-et-Labrador</fme:PRNAME>
<fme:CDUID>1001</fme:CDUID>
<fme:CDNAME>Division No. 1</fme:CDNAME>
<fme:CDTYPE>CDR</fme:CDTYPE>
<fme:CCSUID>1001519</fme:CCSUID>
<fme:CCSNAME>St. John's</fme:CCSNAME>
<fme:CSDUID>1001519</fme:CSDUID>
<fme:CSDNAME>St. John's</fme:CSDNAME>
<fme:CSDTYPE>CY</fme:CSDTYPE>
<fme:ERUID>1010</fme:ERUID>
<fme:ERNAME>Avalon Peninsula</fme:ERNAME>
<fme:FEDUID>10007</fme:FEDUID>
<fme:FEDNAME>St. John's South--Mount Pearl / St. John's-Sud--Mount Pearl</fme:FEDNAME>
<fme:SACCODE>001</fme:SACCODE>
<fme:SACTYPE>1</fme:SACTYPE>
<fme:CMAUID>001</fme:CMAUID>
<fme:CMAPUID>10001</fme:CMAPUID>
<fme:CMANAME>St. John's</fme:CMANAME>
<fme:CMATYPE>B</fme:CMATYPE>
<fme:CTUID>0010003.01</fme:CTUID>
<fme:CTNAME>0003.01</fme:CTNAME>
<fme:ADAUID>10010015</fme:ADAUID>
<fme:DAUID>10010202</fme:DAUID>
<gml:surfaceProperty>
<gml:Surface srsName="urn:ogc:def:crs:EPSG::3347" srsDimension="2">
<gml:patches>
<gml:PolygonPatch>
<gml:exterior>
<gml:LinearRing>
<gml:posList>8979489.93714421 2148660.22857111 8979433.25999921 2148615.68285611 8979342.05142921 2148718.48285611 8979389.55142921 2148774.91428611 8979408.69714421 2148804.85714611 8979410.04856921 2148807.62285612 8979427.40856921 2148833.40285611 8979439.68571422 2148885.92285611 8979440.24285422 2148887.11714611 8979451.08856921 2148909.40571611 8979483.10285421 2148945.63428611 8979539.50285421 2148889.48000111 8979516.25999921 2148862.55714611 8979509.69142921 2148848.88571611 8979487.88856921 2148770.13714611 8979480.16571421 2148756.90285611 8979460.72856921 2148737.50571611 8979455.81999921 2148723.84857111 8979458.11999922 2148705.52285611 8979461.08571421 2148701.36285611 8979461.09999921 2148699.86857111 8979489.93714421 2148660.22857111</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:PolygonPatch>
</gml:patches>
</gml:Surface>
</gml:surfaceProperty>
</fme:ldb_000b16g_e>
</gml:featureMember>
<gml:featureMember>
<fme:ldb_000b16g_e gml:id="id
With the following code:
from pyproj import Proj, transform, CRS, Transformer
inProj = CRS.from_epsg(3347)
outProj = CRS.from_epsg(4326)
x, y = 8979444.20611001, 2148774.86356001
t = Transformer.from_crs(inProj, outProj)
t.transform(x,y)
I get (47.53880067785412, -52.746286073488385)
which is about right for St Johns.
Correct answer by Ian Turton on October 2, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP