Skip to main content
Question

How can I convert a gml attribute in xml read with feature paths to geometry


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?

5 replies

erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 2, 2016

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.


takashi
Influencer
  • February 2, 2016

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).


  • Author
  • February 3, 2016
erik_jan wrote:

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.


takashi
Influencer
  • February 3, 2016
lucmegens wrote:

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.


erik_jan
Contributor
Forum|alt.badge.img+17
  • Contributor
  • February 3, 2016
lucmegens wrote:

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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings