Skip to main content
Solved

Geomtery from XML

  • September 23, 2020
  • 4 replies
  • 28 views

mathiku
Contributor
Forum|alt.badge.img+7

Attribute _xml_fragment contains: 

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ns2:Envelope xmlns:ns2="http://standardit.tapio.fi/schemas/forestData/envelope" xmlns:ns46="http://standardit.tapio.fi/schemas/forestData/WorkingSiteOperational" xmlns:ns5="http://standardit.tapio.fi/schemas/header" xmlns:ns7="http://www.opengis.net/gml" xmlns:ns8="http://standardit.tapio.fi/schemas/forestData/common/geometricDataTypes">
  <ns2:Header>
    <ns5:MessageType>WorkingSiteOperational</ns5:MessageType>
    <ns5:TransmissionId>11920</ns5:TransmissionId>
    <ns5:BusinessSender>FI17017343</ns5:BusinessSender>
    <ns5:BusinessReceiver>DK27623549</ns5:BusinessReceiver>
    <ns5:TransmissionSender>CF-HARVEST</ns5:TransmissionSender>
    <ns5:TransmissionReceiver>WF</ns5:TransmissionReceiver>
    <ns5:System>dev</ns5:System>
    <ns5:TransmissionTime>2020-09-21T12:10:29.035Z</ns5:TransmissionTime>
    <ns5:Action>1</ns5:Action>
  </ns2:Header>
  <ns2:Message>
    <ns2:WorkingSiteOperational>
      <ns46:ServiceBuyerId>DK27623549</ns46:ServiceBuyerId>
      <ns46:WorkingSiteId>113107-1</ns46:WorkingSiteId>
      <ns46:PurchaseContractNumber>Mangler</ns46:PurchaseContractNumber>
      <ns46:WorkingSiteNumber>113107-1</ns46:WorkingSiteNumber>
      <ns46:WorkingSiteName>Test FWMobile HRW</ns46:WorkingSiteName>
      <ns46:ContractorId>DK27623549</ns46:ContractorId>
      <ns46:ContractId>DK27623549</ns46:ContractId>
      <ns46:ServiceType>2</ns46:ServiceType>
      <ns46:OperationalRegion>Østjylland</ns46:OperationalRegion>
      <ns46:ServiceBuyerContactInformation>
        <ns46:ServiceBuyer>
          <ns46:Name>HRW</ns46:Name>
          <ns46:PhoneNumber>40322234</ns46:PhoneNumber>
          <ns46:EmailAddress>HRW@hedeselskabet.dk</ns46:EmailAddress>
          <ns46:LanguageCode>en</ns46:LanguageCode>
          <ns46:SendWorkingAloneNotification>0</ns46:SendWorkingAloneNotification>
          <ns46:SendNotifications>1</ns46:SendNotifications>
          <ns46:NotificationContactPerson>1</ns46:NotificationContactPerson>
        </ns46:ServiceBuyer>
      </ns46:ServiceBuyerContactInformation>
      <ns46:ForestOwners>
        <ns46:ForestOwner>
          <ns46:Owner>
            <Name>Århus/Randers</Name>
          </ns46:Owner>
        </ns46:ForestOwner>
      </ns46:ForestOwners>
      <ns46:Accessibility>1</ns46:Accessibility>
      <ns46:ReadyToDo>1</ns46:ReadyToDo>
      <ns46:WorkingsiteInfo>Fra LandInfo  30102018  æøå</ns46:WorkingsiteInfo>
      <ns46:OperationRestriction>
        <ns46:Description>1</ns46:Description>
      </ns46:OperationRestriction>
      <ns46:ForestCertification>1</ns46:ForestCertification>
      <ns46:MainWorkCode>1056</ns46:MainWorkCode>
      <ns46:Assortments/>
      <ns46:Stands>
        <ns46:Stand>
          <ns46:StandId>2</ns46:StandId>
          <ns46:Geometry>
            <ns7:polygonProperty>
              <gml:Polygon xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
  <gml:exterior>
    <gml:LinearRing srsDimension="2">
      <gml:posList>9.427851579 56.448124911 9.427915952 56.447846212 9.428527496 56.448095262 9.427851579 56.448124911</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>
            </ns7:polygonProperty>
          </ns46:Geometry>
          <ns46:WorkCodes>
            <ns46:WorkCode>
              <ns46:WorkingCode>305</ns46:WorkingCode>
              <ns46:Amount>2500</ns46:Amount>
              <ns46:Unit>2</ns46:Unit>
            </ns46:WorkCode>
          </ns46:WorkCodes>
          <ns46:Materials/>
        </ns46:Stand>
        <ns46:Stand>
          <ns46:StandId>3</ns46:StandId>
          <ns46:Geometry>
            <ns7:polygonProperty>
              <gml:Polygon xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
  <gml:exterior>
    <gml:LinearRing srsDimension="2">
      <gml:posList>9.439068577189573 56.44838878323298 9.438875458140501 56.44773947575235 9.440093181033262 56.44769500223124 9.440152189631588 56.44830280251443 9.439068577189573 56.44838878323298</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>
            </ns7:polygonProperty>
          </ns46:Geometry>
          <ns46:WorkCodes>
            <ns46:WorkCode>
              <ns46:WorkingCode>306</ns46:WorkingCode>
              <ns46:Amount>3</ns46:Amount>
              <ns46:Unit>1</ns46:Unit>
            </ns46:WorkCode>
          </ns46:WorkCodes>
          <ns46:Materials/>
        </ns46:Stand>
        <ns46:Stand>
          <ns46:StandId>1</ns46:StandId>
          <ns46:Geometry>
            <ns8:MultiPolygonGeometry>
              <gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xs="http://www.w3.org/2001/XMLSchema" srsDimension="2">
  <gml:polygonMember>
    <gml:Polygon srsDimension="2">
      <gml:exterior>
        <gml:LinearRing srsDimension="2">
          <gml:posList>9.430887722 56.447239631 9.430881551 56.447222447 9.430881089 56.447221605 9.43088034 56.447220828 9.430862765 56.44720626 9.430861757 56.44720558 9.430860528 56.447205022 9.430834225 56.447195288 9.430831302 56.447194617 9.430800276 56.447191199 9.430798694 56.447191113 9.430797112 56.447191199 9.430766086 56.447194617 9.430763163 56.447195288 9.43073686 56.447205022 9.430735632 56.44720558 9.430734623 56.44720626 9.430717048 56.447220828 9.430716299 56.447221605 9.430715838 56.447222447 9.430709666 56.447239631 9.430709666 56.447241383 9.430715837 56.447258567 9.430716299 56.447259409 9.430717048 56.447260185 9.430734623 56.447274753 9.430735631 56.447275433 9.43073686 56.447275992 9.430763163 56.447285726 9.430766086 56.447286396 9.430797112 56.447289814 9.430798694 56.447289901 9.430800276 56.447289814 9.430831302 56.447286396 9.430834225 56.447285726 9.430860528 56.447275992 9.430861757 56.447275433 9.430862765 56.447274753 9.43088034 56.447260185 9.430881089 56.447259409 9.430881551 56.447258567 9.430887722 56.447241383 9.430887722 56.447239631</gml:posList>
        </gml:LinearRing>
      </gml:exterior>
    </gml:Polygon>
  </gml:polygonMember>
</gml:MultiPolygon>
            </ns8:MultiPolygonGeometry>
          </ns46:Geometry>
          <ns46:WorkCodes>
            <ns46:WorkCode>
              <ns46:WorkingCode>1056</ns46:WorkingCode>
              <ns46:Amount>1</ns46:Amount>
              <ns46:Unit>1</ns46:Unit>
            </ns46:WorkCode>
          </ns46:WorkCodes>
          <ns46:Materials>
            <ns46:Material>
              <ns46:MaterialId>1</ns46:MaterialId>
              <ns46:MaterialCode>30107</ns46:MaterialCode>
              <ns46:Amount>1.5</ns46:Amount>
              <ns46:Unit>3</ns46:Unit>
            </ns46:Material>
          </ns46:Materials>
        </ns46:Stand>
      </ns46:Stands>
      <ns46:Storages/>
    </ns2:WorkingSiteOperational>
  </ns2:Message>
</ns2:Envelope>

I tried using XMLFragmenter to extract the GML and follow up by GeometryExtractor. 

However I can't extract the geometry.

I then tried to create a WKT from the posList, but it seems redundant. 

The extracted GML:

<?xml version="1.0" encoding="UTF-16"?><ns46:Geometry xmlns:ns46="http://standardit.tapio.fi/schemas/forestData/WorkingSiteOperational">
            <ns7:polygonProperty xmlns:ns7="http://www.opengis.net/gml">
              <gml:Polygon srsDimension="2" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sch="http://www.ascc.net/xml/schematron" xmlns:gml="http://www.opengis.net/gml">
  <gml:exterior>
    <gml:LinearRing srsDimension="2">
      <gml:posList>9.427851579 56.448124911 9.427915952 56.447846212 9.428527496 56.448095262 9.427851579 56.448124911</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>
            </ns7:polygonProperty>
          </ns46:Geometry>

 

Best answer by ebygomm

If you have extracted the gml, it is a geometry replacer you need to build the geometries

View original
Did this help you find an answer to your question?

4 replies

debbiatsafe
Safer
Forum|alt.badge.img+20
  • Safer
  • September 24, 2020

Hi @mathiku​ 

You can also try using the GML reader to read the snippet and create the geometries. I have attached an example workspace using this approach. I hope it helps.


mathiku
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 24, 2020
debbiatsafe wrote:

Hi @mathiku​ 

You can also try using the GML reader to read the snippet and create the geometries. I have attached an example workspace using this approach. I hope it helps.

Thanks - that's a great method.

I need to run it on a server, it's not time critical, but I suspect that the AttributeFileWriter adds a lot of overhead.

Do you see other ways, preferably keeping it in attributes.


ebygomm
Influencer
Forum|alt.badge.img+33
  • Influencer
  • Best Answer
  • September 24, 2020

If you have extracted the gml, it is a geometry replacer you need to build the geometries


mathiku
Contributor
Forum|alt.badge.img+7
  • Author
  • Contributor
  • September 24, 2020
ebygomm wrote:

If you have extracted the gml, it is a geometry replacer you need to build the geometries

Sorry.

I read your response too fast.

I tried the geometryreplacer.

Works like a charm :)

Thanks for the help.

 


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