[OpenLayers-Users] getting features from GML.v3().read()

Huub Fleuren huub.gis at gmail.com
Thu Nov 13 06:26:17 PST 2014


... which looks like this, to be complete:

<?xml version="1.0" encoding="UTF-8"?>
<gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml" xmlns:xs="
http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink
">
<gml:geometryMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>116200.0,300000.0 118000.0,330000.0 116875.0,358125.0
118000.0,360000.0 118000.0,380000.0 116125.0,376875.0 115200.0,400000.0
120000.0,400000.0 120000.0,300000.0 116200.0,300000.0</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:geometryMember>
<gml:geometryMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>116200.0,300000.0 110000.0,300000.0 110000.0,400000.0
115200.0,400000.0 116125.0,376875.0 112000.0,370000.0 112000.0,350000.0
116875.0,358125.0 118000.0,330000.0 116200.0,300000.0</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:geometryMember>
</gml:MultiGeometry>

On Thu, Nov 13, 2014 at 2:27 PM, Huub Fleuren <huub.gis at gmail.com> wrote:

> ... allthough this works only for gml 2.1.2 not 3.1.1.
>
> On Thu, Nov 13, 2014 at 2:21 PM, Huub Fleuren <huub.gis at gmail.com> wrote:
>
>> Oh ,but it works if I do it like so:
>>
>> var gml = new OpenLayers.Format.GML();
>> gml.featureName="geometryMember"
>> var features = gml.read(data);
>>
>> Thanks, great stuff ;-)
>>
>> On Thu, Nov 13, 2014 at 1:18 PM, Bart van den Eijnden <
>> bartvde at boundlessgeo.com> wrote:
>>
>>> Okay I see the issue now, there is no reader for MultiGeometry probably
>>> since the reader is limited to only the Simple Features profile.
>>>
>>> Bart
>>>
>>> On Thu, Nov 13, 2014 at 12:33 PM, Huub Fleuren <huub.gis at gmail.com>
>>> wrote:
>>>
>>>> Bart man,
>>>> The problem is in readNode. It will select only "gml:featureMembers".
>>>> Tweaking with these names, or adding new names to the reader list, does
>>>> not help. Even though componentlists are filled readingNodes, the features
>>>> list remains empty.
>>>>
>>>> Huub
>>>>
>>>> On Wed, Nov 12, 2014 at 6:57 PM, Bart van den Eijnden <
>>>> bartvde at boundlessgeo.com> wrote:
>>>>
>>>>> Hey Huub,
>>>>>
>>>>> try calling readNode directly. Since these are geometries only and not
>>>>> features, read will probably not work.
>>>>>
>>>>> See the GML/v3 testcases for examples.
>>>>>
>>>>> Best regards,
>>>>> Bart
>>>>>
>>>>> Bart van den Eijnden
>>>>> Front End Software Engineer | Boundless <http://boundlessgeo.com/>
>>>>> bartvde at boundlessgeo.com
>>>>> 1-877-673-6436 <917-460-7207>
>>>>> @boundlessgeo <http://twitter.com/boundlessgeo/>
>>>>>
>>>>> <http://boundlessgeo.com>
>>>>>
>>>>> On 12 Nov 2014, at 16:29, Huub Fleuren <huub.gis at gmail.com> wrote:
>>>>>
>>>>> Hi List,
>>>>>
>>>>> I was trying to read the following GML text with the Format.GML.v3
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <gml:MultiGeometry xmlns:gml="http://www.opengis.net/gml"
>>>>> xmlns:xs="http://www.w3.org/2001/XMLSchema"
>>>>> xmlns:xlink="http://www.w3.org/1999/xlink"
>>>>> xmlns:sch="http://www.ascc.net/xml/schematron" srsDimension="2">
>>>>> <gml:geometryMember>
>>>>> <gml:Polygon srsDimension="2">
>>>>> <gml:exterior>
>>>>> <gml:LinearRing srsDimension="2">
>>>>> <gml:posList>115.0 15.5 118.0 16.0 118.0 18.0 113.0 17.166666666666668
>>>>> 112.0 18.0 114.5 20.0 120.0 20.0 120.0 10.0 116.2 10.0 118.0 13.0 115.0 15.5
>>>>> </gml:posList>
>>>>> </gml:LinearRing>
>>>>> </gml:exterior>
>>>>> </gml:Polygon>
>>>>> </gml:geometryMember>
>>>>> <gml:geometryMember>
>>>>> <gml:Polygon srsDimension="2"><gml:exterior><gml:LinearRing
>>>>> srsDimension="2">
>>>>> <gml:posList>115.0 15.5 118.0 13.0 116.2 10.0 110.0 10.0 110.0 20.0
>>>>> 114.5 20.0 112.0 18.0 113.0 17.166666666666668 112.0 17.0 112.0 15.0 115.0
>>>>> 15.5
>>>>> </gml:posList>
>>>>> </gml:LinearRing>
>>>>> </gml:exterior>
>>>>> </gml:Polygon>
>>>>> </gml:geometryMember>
>>>>> </gml:MultiGeometry>
>>>>>
>>>>> code:
>>>>> var gml = new OpenLayers.Format.GML.v3(); var features =
>>>>> gml.read(GMLtext);
>>>>>
>>>>>
>>>>> Apparently this is parsed correctly by Format.XML, but i never get a
>>>>> list of features from the read () function.
>>>>>
>>>>> Is it possible? How?
>>>>>
>>>>> Regards, Huub
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.osgeo.org
>>>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20141113/c0e7ddc4/attachment.html>


More information about the Users mailing list