Question

Problem converting ESRI shapefile to INSPIRE GML - no geometry written

  • 14 February 2019
  • 4 replies
  • 9 views

Badge
A couple of other people have had a question similar to this but I have not actually seen them reply to suggestions from safe staff to say that the issue has been resolved.

 

Firstly, I am very new to FME so there may be a very simple solution that I have overlooked - if so, apologies!

I'm using FME Desktop 2018.1, converting a shapefile containing soil polygons (Annexe III) to INSPIRE compliant GML. In designing the workbench I have followed the general workflow outlined in some of the INSPIRE writing tutorials here (Cadastral parcels, flood zones etc), plus have a workbench from a collaborator at another organisation who is doing a very similar exercise - unfortunately she did her translation using the INSPIRE Solution Pack, and that's not an option for us (too expensive) so I haven't been able to follow it exactly.

 

I have managed to create and rename all of the required attributes, and the last transformer before the writer is the GeometryPropertySetter where I have set the Geometry Name to 'geometry' as advised in multiple places. If I connect an inspector to the output port, everything looks fine. Likewise, I can connect a GeometryValidator and XMLValidator and neither give errors.

 

When I connect to the INSPIRE GML writer, the translation runs successfully with no errors, all of the features are written out, but none of them have geometry. If I look at the file in Data Inspector, the gml file retains the coordinate system (EPSG:4328), and has the correct feature type (in this case SoilBody), but for each of the features all of the extents are listed as 'nan', and the number of vertices = 0. fme_geometry is 'fme_undefined' and fme_type is 'fme_no_geom'.

I have set the properties of the writer so it uses the INSPIRE Themes setting, and have tried 3.0 and 4.0 from the built in options; I have also pointed it at the application schema file soil.xsd (both 3.0 and 4.0 downloaded directly from the INSPIRE website) but all give the same result.

Can someone suggest anything I can try please?


4 replies

Badge

If anyone wants to have a play around, workbench file is attached, along with a zip of the input data.

I've been switching various things on and off to see if it makes any difference. The result I describe above is with 'No Redirect' on; if I 'Redirect to Data Inspector' the output displays as I would have hoped - geometry info is there, although oddly, examining the data table shows the geometry field has the value <missing> for all records

.soils25ktest_v2.fmw

soils_25k.zip

 

Badge +6

Hello @mcc,

 

Taking a look at your workflow, I was able to see the geometry being dropped from the output - as viewed in Data Inspector or an XML Editor. I used FME 2019.0 beta, and as such an error was being reported by the Inspire Writer Validate option. 

The error that was being reported was the following:

XML Validation: Error in 'C:\Users\tkading\Downloads\GML_Shapefile\soils25k_test_dataset_v2.gml' on line 1792, column 17: 'element 'soilBodyLabel' is not allowed for content model '(metaDataProperty*,description?,descriptionReference?,identifier?,name*,boundedBy?,location?,inspireId?,geometry,soilBodyLabel,beginLifespanVersion,endLifespanVersion?,isDescribedBy+)''

What this error is stating, is that an expected element is likely missing before the soilBodyLabel element. From this we can gather that the geometry was dropped as the element preceding the 'soilBodyLabel' is the geometry element. As such, by taking a look at the Inspire Schema found here: https://inspire.ec.europa.eu/data-model/approved/r4618-ir/html/index.htm?goto=2:3:17:1:8708 we can see the SoilBody geometry schema expects a GM_MultiSurface geometry. 

 

The steps to convert this Shape Polygon to a MultiSurface is as follows. This takes place in order directly after the AttributeCopier:

1) 3DForcer - This forces the geometry to have a Z element. We have set the elevation value as 0 here.
http://docs.safe.com/fme/2018.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/3dforcer.htm

2) FaceReplacer - This converts the area geometry of the feature to a face.
http://docs.safe.com/fme/2018.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/facereplacer.htm

3) SurfaceBuilder - This will cut holes in the Surface Feature with another Surface Feature. 
http://docs.safe.com/fme/2018.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/surfacebuilder.htm

4) Aggregator - Combine the Feature geometries into a homogenous aggregate aka (Surface -> MultiSurface). It is important to Group by the attributes on the Features to ensure they are preserved and so that you get a single Multisurface per input feature.
http://docs.safe.com/fme/2018.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/aggregator.htm

 

Lastly, the features are then passed into the GeometryPropertySetter where we set the Property to Geometry Name and the name as 'geometry'.

This should allow your output to contain the valid geometries. 

24953-soils25ktest-v2-solution.fmw

Note: The above workflow will create a valid Inspire GML, however it will only be valid for this single Feature Type and not a Complete Dataset given the required dependencies between feature types as shown in the schema UML diagrams.

Badge

@trentatsafe

Hi Trent

Thanks so much for taking the time to look at it for me. I'm actually between machines at the moment so won't get a chance to test this for a couple of days, but I think I follow what you are suggesting. I did struggle to get my head round the MultiSurface property when I was reading the documentation, and hadn't realise that the lack of a z dimension might be causing the issue as our polygons are 'flat' and none of the other examples I looked at had anything more complex than including the GeometryPropertySetter transformer in the workflow.

I'll report back on progress. Luckily, this dataset has no dependencies so if I can get the geometry to work then that's one ticked off the list. And I'm pretty sure that other people will be hitting this issue over the coming months as the compliance deadline nears, so if this helps other people avoid needless headscratching then so much the better!

Best wishes

Malcolm

Badge

Now I've had a chance to look, seems to be fine except for the way that island polygons are being treated. At the bottom of the dataset the large polygon 'disappears' after transformation to be replaced by an aggregate of all of the islands. Meanwhile in the upper left there is another donut polygon which transforms as expected.

Past experience would suggest to me that it is 99% likely to be some issue with the shapefile, but have you ever seen anything like this before? Also, adding a GeometryRefiner as the first step leads to the large polygon transforming fine, and the small one 'inverting'! Have uploaded some pics to try and show what I mean.

Thanks, Malcolm

Reply