Solved

I could not visualize the boundry of the polygon and extract the geograhphic location


Badge +3

 

Dear FME community.

I got xml data with geographic location,  I tried to use coordinateExtractor but I could not get x and y coordinates and I could not also visualize the polygon using FME inspector. How do  Extract the X and y attribute? 

Any idea would be apricated and thank you in advance.

 

 

icon

Best answer by becchr 7 March 2024, 16:44

View original

10 replies

Userlevel 5
Badge +36

You can extract the GML data in the XMLFragmenter, followed by a GeometeryReplacer to convert the GML to a geometry.

You can also use a StringSearcher to search for the GML part of the XML. The regular expression in the StringSearcher could be something like

 (<gml:Surface .*?</gml:Surface>)

The exact implementation depends on your XML data.

Badge +3

Thank you for your prompt replay. I don’t know if I have formulated my question good.  FME is not understanding the list of coordinates in my XML. I tried to use the transformer 

"GeometeryReplacer "like  you said, still I am getting error.

 

Userlevel 3
Badge +18

Hi, seems to work fine on 2023.2, could the workspace attached help you?

Entered the gml from your screenshot as an attribute, makes a geometry of it!

Userlevel 5
Badge +36

I think the question behind the question is how to extract the GML data from the XML.

 

Badge +3

 

Thank you.  I am using data Interoperability ,I guess it is has same  transformers as FME. Still I am not getting Geometric attributeT

 

GeometryReplacer_<Rejected> (TeeFactory): GeometryReplacer_<Rejected>: Termination Message: 'GeometryReplacer output a <Rejected> feature.  To continue translation when features are rejected, change 'Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''
 

 

Userlevel 5
Badge +36

You use the whole XML in the GeometryExtractor, but you should first create an attribute that contains only the GML part of the XML. 

The exact implementation depends on your XML data.

Userlevel 3
Badge +18

I’m not familiar with data interoparability, but it should be the same transformers indeed.

Thanks for your workspace, but the sourcefile is missing (test.xml), if you could share it might be easier to help?

I see you use an attribute “vlaklocatie.surfaceMember.Polygon.exterior.LinearRing.posList” in the geometryreplacer, but that should be “vlaklocatie.surfaceMember” (I think, as geomancer mentioned it should be the gml-part of the xml)

Badge +3

 

 I really appreciate for your help. Indeed it is easier if I send the example of XMl I am dealing with. Hooping you will get some time to look at it.

Once again Thank you!!

Userlevel 3
Badge +18

Thanks, if in the XML-reader you set ‘Elements to Match’ to (based on the xml you just send):

xml-tables/projectlocaties-table/projectlocaties xml-tables/projectlocaties-table/projectlocaties/projectlocaties/projectlocatie/coordinatenEtrs/vlaklocatie

 

it will extract the GML-part you need to an attribute xml_fragment:

You can use this attribute in the GeometryReplacer and you’ll get the geometry

I see there’s the same geometry in a different coordinate system too (RD), if you prefer that one, the ‘Elements to match’ should be:

xml-tables/projectlocaties-table/projectlocaties xml-tables/projectlocaties-table/projectlocaties/projectlocaties/projectlocatie/coordinatenOpgegeven/vlaklocatie

 

Hope this helps, not sure how to implement it in Data Interoperability but guess it won’t be that different?

Badge +3

Beste becchr and geomancer

 Thank you for your help. Now it is working . The probleem was with the workspace Parameter. It was rejecting it now i changed the setting to continue  Translation

Workspace Parameters' > Translation > 'Rejected Feature Handling' to 'Continue Translation''

 Once again  Thank you

Greetings

Helen

Reply