[gdal-dev] GDAL GML and OpenLayers

Even Rouault even.rouault at spatialys.com
Wed Sep 13 02:53:38 PDT 2017


On mercredi 13 septembre 2017 10:39:50 CEST Ari Jolma wrote:
> 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:exterior isn't GML2, but GML3. Perhaps you should try FORMAT=GML3 instead then.

> <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
> 
> 
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev


-- 
Spatialys - Geospatial professional services
http://www.spatialys.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20170913/9b6cac0a/attachment.html>


More information about the gdal-dev mailing list