question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GML Linearring should not have srsName attribute

See original GitHub issue

Describe the bug The OpenLayers GML formats have an issue serializing a geometry to GML: <gml:LinearRing> element should not have srsName attribute.

Reference: http://www.datypic.com/sc/niem21/e-gml32_LinearRing.html

To Reproduce Steps to reproduce the behavior:

  1. Create an ol geometry
  2. Write features from GML format of this geometry
  3. Output GML (both version 2 and 3) will have an srsName
<gml:exterior>
  <gml:LinearRing srsName="urn:x-ogc:def:crs:EPSG:4326">
    <gml:posList srsDimension="2">38.5571 -75.7071 38.4631 -75.6991 38.4551 -75.3501

Expected behavior <gml:LinearRing> does not have srsName attribute.

<gml:exterior>
  <gml:LinearRing>
    <gml:posList srsDimension="2">38.5571 -75.7071 38.4631 -75.6991 38.4551 -75.3501

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
ahocevarcommented, Sep 4, 2020

I guess the most generic way to achieve this is a change in our GML serializers so the srsName is only set on the “outermost” geometric entity. So in the case of a polygon, only the gml:Polygon would get the attribute. Or e.g. for a MultiPoint, only the gml:MultiPoint and not its point members.

1reaction
ahocevarcommented, Sep 4, 2020

Correct. In GML2, a LinearRing is a geometry primitive, which can have a srsName, but the spec states in 4.3.3

Since a LinearRing is used in the construction of Polygons (which specify their own SRS), the srsName attribute is not needed.

Also in GML3, the LinearRingPropertyType, which is used for the rings of a polygon, is made of a sequence of LinearRings, which have a hierarchy of AbstractRing -> AbstractCurve -> AbstractGeometricPrimitive -> AbstractGeometry. For that, the spec states

Any geometry element that inherits the semantics of AbstractGeometryType may be viewed as a set of direct positions. All of the classes derived from AbstractGeometryType inherit an optional association to a coordinate reference system. All direct positions shall directly or indirectly be associated with a coordinate reference system. When geometry elements are aggregated in another geometry element (such as a MultiGeometry or GeometricComplex), which already has a coordinate reference system specified, then these elements are assumed to be in that same coordinate reference system unless otherwise specified.

OpenLayers also has a LinearRing geometry. If such a LinearRing is serialized in GML, its srsName attribute makes sense and is needed to indicate the SRS. For the rings of a polygon, there is nothing wrong about proposing the removal of the srsName, at least for GML2. But for both GML2 and GML3, the XML is still valid with the srsName on a LinearRing, also for the rings of a Polygon.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Draft Thoughts on best practices for using GML in HAVE ...
The gml:id attribute is retained so that geometry objects may still be the target of a ... The following example does not use...
Read more >
Schema documentation for namespace http://www.opengis ...
If no srsName attribute is given, the CRS must be specified as part of the larger context this geometry element is part of,...
Read more >
#5606 (Position of srsDimension in GML structure) – GDAL
The following GML will not parse as 3-dimensional. ... <gml:LinearRing> ... When the srsName attribute is omitted, this attribute shall be omitted." " ......
Read more >
Problem converting to SqlGeometry from gml - MSDN - Microsoft
Answers · 1) Remove srsName attribute to avoid the error 24130 · 2) Replace 'outerBoundaryIs' by 'exterior' · 3) Replace 'coordinates' by 'posList'....
Read more >
Schema documentation for geometryBasic0d1d.xsd
The gml:axisAbbrev value should be used for these axis labels, after spaces and forbiddden characters are removed. When the srsName attribute is included, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found