Skip to main content
Question

Integration of QGIS Model (py) in FME


sel
Contributor
Forum|alt.badge.img+2
  • Contributor

I created models in QGIS Desktop. These models repair geometries of lines and polygons. Now I want to reduce the working steps, so that the data gets directly repaired in FME. Does anyone has experience in that?

10 replies

hkingsbury
Celebrity
Forum|alt.badge.img+53
  • Celebrity
  • November 6, 2024

FME does have the GeometryValidator transformer that can repair invalid geometries:

https://docs.safe.com/fme/2022.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/geometryvalidator.htm

 

To incorporate your models in FME, you’ll need to first export them to python. You can then use the PythonCaller to call those scripts. You will need to instruct FME to use QGISs python instance, theres some information on doing that here:
 

 


sel
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 7, 2024

Thanks @hkingsbury for you answer. Unfortunately, the GeometryValidator transformer does not repair all of the invalid geometries. So I had to create a QGIS model that uses the following tools:
1. Fix geometry
2. Delete duplicate geom.
3. Remove null geometries
4. Fix geometry

Otherwise there is an error when loading the output data into a postgis database. I didn’t manage to get the python command of the QGIS model running in FME yet.


redgeographics
Celebrity
Forum|alt.badge.img+49

Can you be a bit more specific about the geometries that are not repaired? Maybe there’s another way...


sel
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 7, 2024

I have this GeometryValidator. And the following issues, which data land at “Failed”.

 


redgeographics
Celebrity
Forum|alt.badge.img+49

Why does that feature fail the OGC checks (which the GeometryValidator can’t repair indeed)?


sel
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 7, 2024
redgeographics wrote:

Why does that feature fail the OGC checks (which the GeometryValidator can’t repair indeed)?

Where can I find that out specifically? 


redgeographics
Celebrity
Forum|alt.badge.img+49

You can scroll a bit further down in the Feature Information to check the coordinates. It’s hard to say because “fails OGC check” can have different causes of course.


sel
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 7, 2024
redgeographics wrote:

You can scroll a bit further down in the Feature Information to check the coordinates. It’s hard to say because “fails OGC check” can have different causes of course.

 

 


redgeographics
Celebrity
Forum|alt.badge.img+49

My bet is that it may have to do with the fact that (part) of that object is a Bezier curve. I don’t know off the top of my head if there’s a transformer to fix that, maybe the ArcStroker. 


sel
Contributor
Forum|alt.badge.img+2
  • Author
  • Contributor
  • November 7, 2024
redgeographics wrote:

My bet is that it may have to do with the fact that (part) of that object is a Bezier curve. I don’t know off the top of my head if there’s a transformer to fix that, maybe the ArcStroker. 

I tried the ‘ArcStroker’, that didn’t work. So I put the ‘Geometry Refiner’ after and it worked successfully.
Now I hope it also works with lines.

 

Thanks a lot for your help! :D 


Reply


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