Skip to main content
Hello!

 

 

I'm a beginner so is there a simple way how I can create a polygon out of this GML string?

 

 

<s100:Polygon>

 

          <s100:exterior>

 

            <s100:LinearRing>

 

              <s100:posList>27.65 60.56 27.77 60.6 27.89 60.58 27.9 60.53 27.83 60.5 27.82 60.49 27.71 60.49 27.65 60.56</s100:posList>

 

            </s100:LinearRing>

 

          </s100:exterior>

 

        </s100:Polygon>

 

 

Thanks for any help!
Hi,

 

 

use the GeometryReplacer with "KML" as the geometry encoding type.

 

 

David
Sorry for the typo, the geometry encoding is supposed to be GML...

 

 

David
Hi David,

 

 

thanks for your very quick reply.

 

 

I don't get the GML reader loaded, I get the error:

<GML Reader> - No GML features were found in the set of XML Schemas, make sure that at least one of the schemas is a user, domain or community-specific "GML Application Schema".

 

 

GML reader appears in the Navigator windows but not in the main window.

 

 

I tried it with the XML reader, connect it with the GeometryReplacer and get the following error:

 

XML Parser error: 'Error in input dataset:'XML-Document-Stream' line:1 column:1 message:invalid document structure'

 

 

What's wrong with line 1?

 

 

<?xml version="1.0" encoding="UTF-8"?>

 

 

I'm an FME beginner AND have no clue about XML/GML......
Hi Kathy,

 

 

Unless FME has a specific reader for your file format (such as CityGML or LandXML), you will have to parse it yourself to extract the string containing the geometry. When you have the geometry (as in your original question) in a text attribute in FME, you can then use the GeometryReplacer as I suggested below.

 

 

Starting here would probably be your best bet. Also take a look at this recorded webinar on how to read XML with FME.

 

 

David
The quickest approach is to use a Creator Transformer. Then copy the coordinate values and paste them into the 'Coordinate List' parameter when the 'Geometry Source' is set to '2D Coordinate List' as below. It's simple but it works:

 

 

 


Thank you for the links, David!
Hi Dave,

 

 

thanks for this Creator idea but my string was just 1 out of some more in this file.

 

With the Creator I would have to do that for every single string?

 


Hi Kathy,

 

 

Creator is very simple but it can create just one feature per a transformer. If there are many polygons in your dataset, I think you had better start with 'Feature Paths' method, as David R. has suggested already. http://fmepedia.safe.com/articles/How_To/Reading-XML Don't worry. Feature Paths is very easy to learn.

 

 

Takashi
Hi Kathy,

 

Welcome to the world of FME! I think there's some confusion because you don't say how your GML is stored or where it comes from.

 

 

The snippet you provide is valid GML and I can read it fine, but then many formats of data use GML to store spatial data but wrap it in XML that has a non-standard structure. KML is an example of this, as is GeoRSS.

 

 

The header of the file should give you clues as to whether the data is something standard that FME could read - particularly any definition of schema or namespaces (xmlns). Can you post the first few lines for us to see?

 

 

We have an example of reading data like this in our XML training course. When it's XML data containing GML snippets like this then you should use the XML format reader. Under the parameter "Elements to Match" enter something like "Polygon". This should extract the polygon GML into an attribute called xml_fragment that you can convert into features using the GeometryReplacer transformer.

 

 

You can find the training materials online on our web site. It's example #4 that I am thinking of in particular.

 

 

Hope this is of use

 

 

Mark

 

 

Mark Ireland

 

Product Evangelist

 

Safe Software Inc.

Reply