Coordinate Systems in GML and FME
From Fmepedia
Q) How does FME handle coordinate system definitions inside a GML dataset?
Writing GML
When writing GML, FME attempts to find the EPSG number corresponding to the coordinate system of the data. This match is done by examining the exceptions/epsg.db file. If we can find a match then we write this information to the GML dataset in the form:
srsName="EPSG:####"
We chose this method as being the most sensible, but happily it also seems to be emerging as the de facto standard for such information.
Where we cannot match the user's coordinate system to an EPSG equivalent - and when the user has a custom coordinate system definition there is very little chance of a match - we simply write out the name of the coordinate system from FME. This is not much use to whomever gets the file - unless, of course, they also happen to be using FME and also possess any custom definitions - but is better than nothing.
Reading GML
When reading GML, FME will try to convert the srsName URI strings into their FME equivalents. If the coordinate sys name is of the "EPSG:####" form then all should be well, but failing that there's a file that helps the GML reader carry out the match. The file is located at {FME installed dir}\xml\gml\xfmaps\gml_keywords.xml.
The other function served by this gml_keywords.xml file is to specify the axis order for the coordinate system; for example is it X/Y or Y/X. Right now, only EPSG:4326 and EPSG:4329 are listed:
<group name="srsName-to-axisOrder"> <keyword name="EPSG:4326" value="2,1"/> <keyword name="EPSG:4329" value="2,1,3"/> </group>
Coordinate systems not listed default to x,y (1,2). Reading GML 2.1.2 is fine, because each axis is separated by a comma and each coordinate tuple is separated by whitespace, therefore we can at least calculate the dimension implicitly. However, this may cause trouble for GML 3.1.1 coordinates because coordinates axes and tuples are both whitespace separated so there's no implicit way to determine the dimension.
This could be a particular issue for custom coordinate systems (you can even have custom EPSG definitions) in which case change the axis order by updating the "srsName-to-axisOrder" portion in gml_keywords.xml. After adding the custom (EPSG) definition to FME, set axis order values to "1,2" for x,y, "2,1" for y,x, or use the equivalent 3Ds "1,2,3" for x,y,z or "2,1,3" for , y,x,z.
