openlayers: GML3 - WFS (DefaultSRS = EPSG:4326) Bad parsing
I have a GetFeature response from WFS server which have EPSG:4326 as default srs :
Example of GetFeature (WFS 1.1.0) Latitude/Longitude format
<gml:MultiCurve>
<gml:curveMember>
<gml:LineString>
<gml:posList>
48.43280195733815 4.7228979270717497 48.432722674997414 4.7228950702474055 ...
</gml:MultiCurve>
</gml:curveMember>
<gml:LineString>
<gml:posList>
GML3 parsing this response like this :
ol.format.GML3.prototype.readFlatPosList_ = function(node, objectStack) {
var s = ol.xml.getAllTextContent(node, false).replace(/^\s*|\s*$/g, '');
var context = objectStack[0];
**var containerSrs = context['srsName'];**
var containerDimension = node.parentNode.getAttribute('srsDimension');
var axisOrientation = 'enu';
if (containerSrs) {
var proj = ol.proj.get(containerSrs);
axisOrientation = proj.getAxisOrientation();
}
...
context[‘srsName’] can change axisOrientation to ‘neu’ (EPSG:4326)
context(‘srsName’] is only setted here :
ol.format.GMLBase.prototype.readGeometryElement = function(node, objectStack) {
var context = /** @type {Object} */ (objectStack[0]);
context['srsName'] = node.firstElementChild.getAttribute('srsName');
...
Attribute ‘srsName’ not available in geometry node
This method initialize ‘context’ property and ‘srsName’ is never initialized why?
ol.format.WFS.prototype.readFeaturesFromNode = function(node, opt_options) {
var context = /** @type {ol.XmlNodeStackItem} */ ({
'featureType': this.featureType_,
'featureNS': this.featureNS_
});
In my case, this property is never setted and i can’t change axisOrientation to get geometry coordinates like this :
[ 4.7228979270717497, 48.43280195733815, 4.7228950702474055, 48.432722674997414 … ]
This format is needed to transform coordinates to an other coordinates system.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (4 by maintainers)
@bartvde is there any way this can be looked at? Potentially some help with @Hanmac 's pull request #7368 ? We are also having this issue with WFS layers. The geometry nodes don’t have an srsName attribute, but the gml:Envelope node does (urn:ogc:def:crs:EPSG::4326). In the geometry node function, the code assumes a projection of EPSG:3857, which of course reverses the coordinates of features returned by the service in question.
I’m seeing the same issue @Hanmac and @adunham1962.
It would be great if something along the lines of https://github.com/openlayers/openlayers/pull/7368 could get accepted. @ahocevar what changes would be required to https://github.com/openlayers/openlayers/pull/7368 for it to get accepted?