[gdal-dev] GDAL GML and OpenLayers
Even Rouault
even.rouault at spatialys.com
Wed Sep 13 06:27:43 PDT 2017
> It don't work - no features at all - with GML3 and other default
> options. But, when I set FORMAT = GML3, TARGET_NAMESPACE =
> http://www.opengis.net/gml, and PREFIX = ogr (to avoid a namespace
> collision) then it works.
>
Note that if you throw this in a reader that validates against the schema, it will error out
because the generated .xsd will have targetNamespace="http://www.opengis.net/gml"
which will conflict with the OGC GML schemas... So this is definitely a hack and I would not
recommend distributing widely such datasets.
> I don't understand why the default is to put FeatureCollection etc into
> 'http://ogr.maptools.org/'?
Excellent question. Short answer: GML is a mess
Long answer:
gml:FeatureCollection didn't exist in GML 2.1.2. There was only an abstract
_FeatureCollection element of type gml:AbstractFeatureCollectionType, so you had to
subclass it. Then GML 3.1 brought a new gml:FeatureCollection element. Which GML 3.2.1
immediately deprecated ! (it is now in
http://schemas.opengis.net/gml/3.2.1/deprecatedTypes.xsd ), probably for some pedantic
reasons.
When the GML driver was upgraded for GML 3.1, it tried to follow the recommandations of
the OGC 06-049r1 "Geography Markup Language (GML) simple features profile" (for GML
3.1.1) and OGC 10-100r3 "Geography Markup Language (GML) simple features
profile (with Corrigendum)" (for GML 3.2), that both mention
"""This FeatureCollectionNameType does NOT extend gml:AbstractFeatureCollectionType
because that type has been deprecated in GML 3.2."""
So basically they ask to define in your own namespace an element that is a substitution
group of gml:AbstractFeature (for GML 3.2) or gml:_GML (for GML 3.1.1)
I guess OpenLayers doesn't try to read & understand the .xsd that comes with the .gml, and
even if it does, it can actually be challenging to understand that the type that is defined is
actually a feature collection (apart from having FeatureCollection in its name).
~~~~~
Anyway, I've just committed a new dataset creation option,
GML_FEATURE_COLLECTION=YES/NO, that applies only for GML >= 3, and will use
gml:FeatureCollection and gml:featureMember, whatever they are deprecated or not...
Even
--
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/40e6b3ba/attachment-0001.html>
More information about the gdal-dev
mailing list