Skip to main content

I have an xml with feature bag_LVC:Pand with this structure (example):

<bag_LVC:Pand>

 

<bag_LVC:identificatie>0003100000117485</bag_LVC:identificatie>

 

<bag_LVC:aanduidingRecordInactief>N</bag_LVC:aanduidingRecordInactief>

 

<bag_LVC:aanduidingRecordCorrectie>0</bag_LVC:aanduidingRecordCorrectie>

 

<bag_LVC:officieel>N</bag_LVC:officieel>

 

<bag_LVC:pandGeometrie>

 

<gml:Polygon srsName="urn:ogc:def:crs:EPSG::28992">

 

<gml:exterior>

 

<gml:LinearRing>

 

<gml:posList srsDimension="3" count="17">254059.737 593504.637 0.0 254059.227 593500.0 0.0 254059.216 593499.899 0.0 254058.242 593500.0 0.0 254057.914 593500.034 0.0 254057.893 593500.0 0.0 254057.807 593499.863 0.0 254052.074 593490.692 0.0 254052.182 593490.639 0.0 254058.138 593490.002 0.0 254057.932 593488.165 0.0 254074.487 593486.413 0.0 254075.981 593500.0 0.0 254076.265 593502.583 0.0 254076.561 593502.55 0.0 254076.594 593502.847 0.0 254059.737 593504.637 0.0</gml:posList>

 

</gml:LinearRing>

 

</gml:exterior>

 

</gml:Polygon>

 

</bag_LVC:pandGeometrie>

 

<bag_LVC:bouwjaar>1991</bag_LVC:bouwjaar>

 

<bag_LVC:pandstatus>Pand in gebruik</bag_LVC:pandstatus>

 

<bag_LVC:tijdvakgeldigheid>

 

<bagtype:begindatumTijdvakGeldigheid>2010072000000000</bagtype:begindatumTijdvakGeldigheid>

 

</bag_LVC:tijdvakgeldigheid>

 

<bag_LVC:inOnderzoek>N</bag_LVC:inOnderzoek>

 

<bag_LVC:bron>

 

<bagtype:documentdatum>20100720</bagtype:documentdatum>

 

<bagtype:documentnummer>FB 2010/PANDEN001</bagtype:documentnummer>

 

</bag_LVC:bron>

 

</bag_LVC:Pand>

a regular XML reader can't read it. So I try feature paths to read this feature. It does contain gml-geometry. How can I get the bag_LVC:pandgeometrie as the geometry of my feature so I can write it to a shape-file?

Take this part as one attribute:

<gml:Polygon srsName="urn:ogc:def:crs:EPSG::28992">

 

<gml:exterior>

 

<gml:LinearRing>

 

<gml:posList srsDimension="3" count="17">254059.737 593504.637 0.0 254059.227 593500.0 0.0 254059.216 593499.899 0.0 254058.242 593500.0 0.0 254057.914 593500.034 0.0 254057.893 593500.0 0.0 254057.807 593499.863 0.0 254052.074 593490.692 0.0 254052.182 593490.639 0.0 254058.138 593490.002 0.0 254057.932 593488.165 0.0 254074.487 593486.413 0.0 254075.981 593500.0 0.0 254076.265 593502.583 0.0 254076.561 593502.55 0.0 254076.594 593502.847 0.0 254059.737 593504.637 0.0</gml:posList>

 

</gml:LinearRing>

 

</gml:exterior>

 

</gml:Polygon>

And use that attribute in the GeometryReplacer.

That will create the geometry for you.


I believe that the regular XML reader can read the document with the "Feature Paths" configuration (Elements to Match: Pand). Then, since the "Pand" element contains a GML representation as its descendant element, you can use the GeometryReplacer to create a geometry from the XML fragment (Geometry Encoding: GML, Geometry Source: xml_fragment).


Take this part as one attribute:

<gml:Polygon srsName="urn:ogc:def:crs:EPSG::28992">

 

<gml:exterior>

 

<gml:LinearRing>

 

<gml:posList srsDimension="3" count="17">254059.737 593504.637 0.0 254059.227 593500.0 0.0 254059.216 593499.899 0.0 254058.242 593500.0 0.0 254057.914 593500.034 0.0 254057.893 593500.0 0.0 254057.807 593499.863 0.0 254052.074 593490.692 0.0 254052.182 593490.639 0.0 254058.138 593490.002 0.0 254057.932 593488.165 0.0 254074.487 593486.413 0.0 254075.981 593500.0 0.0 254076.265 593502.583 0.0 254076.561 593502.55 0.0 254076.594 593502.847 0.0 254059.737 593504.637 0.0</gml:posList>

 

</gml:LinearRing>

 

</gml:exterior>

 

</gml:Polygon>

And use that attribute in the GeometryReplacer.

That will create the geometry for you.

Yes, but how do I tell the reader to pass this on as a xml_fragment and not to flatten it? I googled around but did not find the answer. Now I use a concatenator to add the tags again around the poslist, so the GeometryReplacer can interpret it. It works but I want a simpler way.


Yes, but how do I tell the reader to pass this on as a xml_fragment and not to flatten it? I googled around but did not find the answer. Now I use a concatenator to add the tags again around the poslist, so the GeometryReplacer can interpret it. It works but I want a simpler way.

If you read the XML document with the XML reader (Configuration Type: Feature Paths, Elements to Match: Pand), the reader feature type adds an attribute called "xml_fragment" which stores an XML fragment of the Pand element. You don't need to consider any special setting. Then, just set the "xml_fragment" to the "Geometry Source" parameter of the GeometryReplacer.


Yes, but how do I tell the reader to pass this on as a xml_fragment and not to flatten it? I googled around but did not find the answer. Now I use a concatenator to add the tags again around the poslist, so the GeometryReplacer can interpret it. It works but I want a simpler way.

You can exclude the geometry part in the flatten options settings (in your case gml:Polygon) and it will become an attribute containing this fragment. Or as mentioned above, you can use the xml_fragment that includes the geometry in the GeometryReplacer.


Reply