Question

FME automatically replaces the xlink.href statement with the original reference in GML.

  • 17 December 2015
  • 4 replies
  • 7 views


I have a simple GML file with one building in it. When i run the file in FME to simply write it again without any operation somehting very strange happens. FME replaces the xlink.href statements in the data with the original data form the reference which already includes a gml:id and that duplicates the IDs in the file.


for example:

Original data:

<gml:MultiSurface>
<gml:surfaceMember xlink:href="#p_r_2"></gml:surfaceMember> 
</gml:MultiSurface>
...
...
...

<gml:Polygon gml:id="p_r_2">
  <gml:exterior>
    <gml:LinearRing>
<gml:posList>2.00 0.00 3.00 2.00 2.00 3.00 1.00 2.00 3.50</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>

Will become this:

<gml:MultiSurface>
    <gml:surfaceMember>
<gml:Polygon gml:id="p_r_2">
  <gml:exterior>
     <gml:LinearRing>
<gml:posList>2.00 0.00 3.00 2.00 2.00 3.00 1.00 2.00 3.50</gml:posList>
    </gml:LinearRing>
   </gml:exterior>
</gml:Polygon>
    </gml:surfaceMember> 
</gml:MultiSurface>
...
...
...

<gml:Polygon gml:id="p_r_2">
  <gml:exterior>
    <gml:LinearRing>
<gml:posList>2.00 0.00 3.00 2.00 2.00 3.00 1.00 2.00 3.50</gml:posList>
    </gml:LinearRing>
  </gml:exterior>
</gml:Polygon>

And you can see there is a duplicate of gml:id="p_r_2". 


Is there anyway to avoid this ? by telling fme not to replace hrefs references and leave them as they are ? 


4 replies

Userlevel 4
Badge +25

I can check with our developers if you like, but in browsing our development database I found the following info in a previous case:

---

Note that <gml:LinearRing> is not and cannot be the value of a <gml:surfaceMember>.

Only <gml:Polygon>, <gml:CompositeSurface>, <gml:Surface> and <gml:OrientableSurface> are substitutable for the abstract <gml:_Surface>.

So the original file is invalid, but an XSD validator will not be able to detect the error because of the xlinks.

---

Do you see an error or warning in the log? I would expect something like:

CityGML Reader: An incompatible linked (xlink:href) geometry was found in the dataset. The GML xlink:href source 'surfaceMember' with link id '#p_r_2' is not compatible with the target's geometry 'LinearRing'.

In short, I believe it's the data that is a problem here. I am a little surprised we duplicate the ID, and don't add a suffix, but I don't know enough about XML to know if that's the best approach or not.

Userlevel 4
Badge +25

I can check with our developers if you like, but in browsing our development database I found the following info in a previous case:

---

Note that <gml:LinearRing> is not and cannot be the value of a <gml:surfaceMember>.

Only <gml:Polygon>, <gml:CompositeSurface>, <gml:Surface> and <gml:OrientableSurface> are substitutable for the abstract <gml:_Surface>.

So the original file is invalid, but an XSD validator will not be able to detect the error because of the xlinks.

---

Do you see an error or warning in the log? I would expect something like:

CityGML Reader: An incompatible linked (xlink:href) geometry was found in the dataset. The GML xlink:href source 'surfaceMember' with link id '#p_r_2' is not compatible with the target's geometry 'LinearRing'.

In short, I believe it's the data that is a problem here. I am a little surprised we duplicate the ID, and don't add a suffix, but I don't know enough about XML to know if that's the best approach or not.

OK. Actually I see a polygon in there. Maybe I'm just plain wrong here. I'll get the developers to check, but leave my (probably incorrect) answer here just in case it helps.

OK. Actually I see a polygon in there. Maybe I'm just plain wrong here. I'll get the developers to check, but leave my (probably incorrect) answer here just in case it helps.

Thank you Mark for the quick reply, First of all i am quite sure that the data is correct as i validated it several times using different validators for both schema and syntax. I also tried with different gml data from another source and got the same results.

You can check page 5 of the OGC standard documentation of the CityGML UML diagram:

http://www.citygml.org/fileadmin/citygml/docs/CityGML_2_0_0_UML_diagrams.pdf

Please also note that i am not an FME expert and i just know some basics. In case you have an advice or a trick that i don't know about in such a situation please feel free to correct me.(i.e don't assume i did everything the absolute right way as i might have missed a step or something however i believe i didn't as it is quite straight forward model). I can also send you the gml i am working on to check yourself or with the developers, it has only one simple building.

I can check with our developers if you like, but in browsing our development database I found the following info in a previous case:

---

Note that <gml:LinearRing> is not and cannot be the value of a <gml:surfaceMember>.

Only <gml:Polygon>, <gml:CompositeSurface>, <gml:Surface> and <gml:OrientableSurface> are substitutable for the abstract <gml:_Surface>.

So the original file is invalid, but an XSD validator will not be able to detect the error because of the xlinks.

---

Do you see an error or warning in the log? I would expect something like:

CityGML Reader: An incompatible linked (xlink:href) geometry was found in the dataset. The GML xlink:href source 'surfaceMember' with link id '#p_r_2' is not compatible with the target's geometry 'LinearRing'.

In short, I believe it's the data that is a problem here. I am a little surprised we duplicate the ID, and don't add a suffix, but I don't know enough about XML to know if that's the best approach or not.

So, any updates from the developers on that matter ?

Reply