[gdal-dev] GDAL GML and OpenLayers
Ari Jolma
ari.jolma at gmail.com
Wed Sep 13 00:39:50 PDT 2017
Hi,
I'm trying to get OpenLayers (v4.3.2) understand GML made by GDAL (in
the context of a WFS). GDAL has a lot of creation options for GML and
the best results I've got with TARGET_NAMESPACE =
http://ogr.maptools.org/, PREFIX = ogr, and FORMAT = GML2. That has
worked with earlier (v2) OpenLayers but with v4 the features are
understood but not their geometries. This may not be the full issue but
if I produce the geometries the way geoserver seems to do, I get OL to
understand them.
Geometry produced by GDAL as GML2, not working with new OL:
<ogr:geometryProperty>
<gml:Polygon srsName="EPSG:3857">
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>2423495.53212975,9236910.2942792
2487091.13966301,9293167.94709709 2491983.10947327,9276046.05276121
2440617.42646563,9212450.44522794
2423495.53212975,9236910.2942792</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</ogr:geometryProperty>
Geometry that works with new OL:
<ogr:geometry>
<gml:Polygon srsName="http://www.opengis.net/gml/srs/epsg.xml#3857"
srsDimension="2">
<gml:exterior>
<gml:LinearRing>
<gml:posList>2423495.53212975 9236910.2942792 2487091.13966301
9293167.94709709 2491983.10947327 9276046.05276121 2440617.42646563
9212450.44522794 2423495.53212975 9236910.2942792</gml:posList>
</gml:LinearRing>
</gml:exterior>
</gml:Polygon>
</ogr:geometry>
I'm using ol.format.WFS to parse the GML. If I give it a constructor
option gmlFormat:ol.format.GML2, the parsing causes an error because
ol.format.GML2 does not have a feature collection parser.
Ari
More information about the gdal-dev
mailing list