-
Notifications
You must be signed in to change notification settings - Fork 310
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add srsName to GML3 (optional) and all GML2 #575
base: develop
Are you sure you want to change the base?
Conversation
[Test] | ||
public void TestGML3Point() | ||
{ | ||
var document = ToGML3(CreatePoint()); | ||
var geometry = CreatePoint(); | ||
var document = ToGML3(geometry); | ||
AssertPoint(document); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the addition, please see comments
@@ -23,6 +22,8 @@ public class GMLWriter | |||
private const int CoordSize = 200; | |||
private readonly GMLVersion _gmlVersion; | |||
private readonly string _gmlNs; | |||
private readonly string _gmlSrsName = "srsName"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private const string GmlSrsName = "srsName";
protected virtual void WriteAttributeSrsName(int srid, XmlWriter xmlWriter) | ||
{ | ||
if(_writeSrsNameAttribute) | ||
xmlWriter.WriteAttributeString(_gmlSrsName, GetSrsName(srid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xmlWriter.WriteAttributeString(GmlSrsName, GetSrsName(srid));
@@ -103,7 +106,7 @@ private static XDocument ToGML3(Geometry geom) | |||
using var ms = new MemoryStream(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change signature to
private static XDocument ToGML3(Geometry geom, bool writeSrsName = true)
Duplicate at least one of the actual tests where writeSrsName
is set to false
Prerequisites
Description
Before I continue with the rest of the tests I would like your input to see if this could be approved.
This PR contains 2 changes to the GML writers.
srsName
attribute.Point
,LinearString
,LinearRing
,Polygon
didn't output thesrsName
while it looks required to me: http://schemas.opengis.net/gml/2.1.2/geometry.xsd .XSD isn't my strong suit, so might be mistaken. It looks like only members of the
MultiPolygon
for example are optional.Possible improvements:
Add new
ctor
forGML3Writer
that would take a pattern as input for examplehttps://www.opengis.net/def/crs/EPSG/0/{0}
.This would be vulnerable to injection so would have to check if it's a
urn
orURI
.Though this could be easily done by creating your own GML writer and inheriting from
GML3Writer
and overridingGetSrsName
.