Hello,
has there been any discussion regarding GML polygons that cross the dateline? Both EPSG:4326 and EPSG:3395 that are the most commonly mentioned projections in context of IWXXM have bounds that range from -180 to +180 with central meridian at 0 degrees longitude:
Take for example this SIGMET in New Zealand Oceanic FIR (ICAO: NZZO) that crosses the dateline (pardon the crude drawing):

For TAC SIGMET output, we store the 4 latitude/longitude coordinates in CW order (plus the 5th one to close the polygon), e.g. WI S4700 W17400 - S5400 W17600 - S5400 E17600 - S4600 E17800 - S4700 W17400. Annex 3 does not really say, which particular parametrization of Mercator should be used to connect the points (i.e. which central meridian to use). The assumption likely is that the end-user or software used for display is clever enough to deduce that this is a polygon that spans the dateline and interpret it as the forecaster meant.
IWXXM/AIXM/GML however are much more precise in the usage of projections, so in the case of EPSG:4326 or EPSG:3395 the projection bounds or central meridian are a part of the CRS definition.
Our software would store the above polygon in EPSG:4326 like this (potentially wrong, but we are not sure):
<aixm:Surface gml:id="uuid.ae8ce712-798d-418c-8bcc-4662b4d2d98a" srsDimension="2" axisLabels="Lat Long" uomLabels="deg deg" srsName="http://www.opengis.net/def/crs/EPSG/0/4326">
<gml:patches>
<gml:PolygonPatch>
<gml:exterior>
<gml:LinearRing>
<gml:posList>-46.00 178.00 -54.00 176.00 -54.00 -176.00 -47.00 -174.00 -46.00 178.00</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:PolygonPatch>
</gml:patches>
</aixm:Surface>
GML requires for exterior rings to be in CCW order. The above points are arguably not CCW - assuming that the CCW rule is relative to the specified CRS, and the above is not really CCW in EPSG:4326, strictly speaking.
If one shifted the longitudes by 180 or 360 to the east, then it would be really counter-clockwise. Or if we used longitude 184 in place of -176, then it would be more clear and CCW. But the problem with such shifted polygons is they would be out of the bounds of EPSG:4326 that end at 180.
If the polygon is written like the above within the -180 to 180 bounds of EPSG:4326, a lot of GIS software would probably interpret the polygon like this:

I was looking at the OGC Use of Geography Markup Language (GML) for Aviation Data (https://portal.opengeospatial.org/files/?artifact_id=62061) but this best practices document does not seem to address the dateline issue.
In the following ESA document https://wiki.services.eoportal.org/tiki-download_wiki_attachment.php?attId=653&usg=AOvVaw3ol5sRYun_Pbb1HvCyyjN5 the same issue with GML and dateline is mentioned in section 3.3
ENCODING RULES FOR GEOMETRIES TO AVOID DATELINE ISSUE from page 24 onwards. They offer some alternative solutions:
- Forbid dateline crossing polygons - so for example in our case (e.g. EPSG:4326 or EPSG:3395) this would mean splitting polygons that cross dateline into two separate exterior linear rings. We have seen this practice used in for example FIR Shapefile maps where the New Zealand Oceanic FIR is encoded as two separate polygons. I do not have other examples at hand but have definitely seen this practice multiple times.
- Represent the polygon in another CRS that does not have the issue - one where the central meridian is not the Greenwich meridian... I am not sure if there are any EPSG/CRS codes for suitable geodesic or Mercator projections that are rotated e.g. 180 degrees though...
- Specify coordinates outside the normal value range - e.g. using longitude 184 instead of -176, but I think then such coordinates would be outside of EPSG:4326 bounds.
- Store the coordinates within EPSG:4326 bounds (as in the aixm:Surface example code above) but declaring a convention that if the points are close to each other on the WGS84 ellipsoid, than the software should be clever enough to figure out what is going on.
From these solutions I have a strong feeling only the first two are correct in terms of the GML specification strictly speaking (splitting the polygon in two, or using a CRS which is rotated by e.g. 180).
Any guidance on this subject is really appreciated.
Boris
Hello,
has there been any discussion regarding GML polygons that cross the dateline? Both EPSG:4326 and EPSG:3395 that are the most commonly mentioned projections in context of IWXXM have bounds that range from -180 to +180 with central meridian at 0 degrees longitude:
Take for example this SIGMET in New Zealand Oceanic FIR (ICAO: NZZO) that crosses the dateline (pardon the crude drawing):

For TAC SIGMET output, we store the 4 latitude/longitude coordinates in CW order (plus the 5th one to close the polygon), e.g. WI S4700 W17400 - S5400 W17600 - S5400 E17600 - S4600 E17800 - S4700 W17400. Annex 3 does not really say, which particular parametrization of Mercator should be used to connect the points (i.e. which central meridian to use). The assumption likely is that the end-user or software used for display is clever enough to deduce that this is a polygon that spans the dateline and interpret it as the forecaster meant.
IWXXM/AIXM/GML however are much more precise in the usage of projections, so in the case of EPSG:4326 or EPSG:3395 the projection bounds or central meridian are a part of the CRS definition.
Our software would store the above polygon in EPSG:4326 like this (potentially wrong, but we are not sure):
GML requires for exterior rings to be in CCW order. The above points are arguably not CCW - assuming that the CCW rule is relative to the specified CRS, and the above is not really CCW in EPSG:4326, strictly speaking.
If one shifted the longitudes by 180 or 360 to the east, then it would be really counter-clockwise. Or if we used longitude 184 in place of -176, then it would be more clear and CCW. But the problem with such shifted polygons is they would be out of the bounds of EPSG:4326 that end at 180.
If the polygon is written like the above within the -180 to 180 bounds of EPSG:4326, a lot of GIS software would probably interpret the polygon like this:

I was looking at the OGC Use of Geography Markup Language (GML) for Aviation Data (https://portal.opengeospatial.org/files/?artifact_id=62061) but this best practices document does not seem to address the dateline issue.
In the following ESA document https://wiki.services.eoportal.org/tiki-download_wiki_attachment.php?attId=653&usg=AOvVaw3ol5sRYun_Pbb1HvCyyjN5 the same issue with GML and dateline is mentioned in section 3.3
ENCODING RULES FOR GEOMETRIES TO AVOID DATELINE ISSUE from page 24 onwards. They offer some alternative solutions:
From these solutions I have a strong feeling only the first two are correct in terms of the GML specification strictly speaking (splitting the polygon in two, or using a CRS which is rotated by e.g. 180).
Any guidance on this subject is really appreciated.
Boris