Skip to main content
Solved

Read only polyline geometry from data (gdb, shp or json)


amdubois

Hello,

 

I'm currently reading multiple data sources with a File/DIRECTORY reader and then using the path to read data whether its from a gdb, shp or json. I'm having trouble understanding how I can manage to read ONLY features that have a POLYLINE geometry. I'm guessing there is something to do in the constraint parameters of a FeatureReader transformer but, for the life of me, I can't seem to figure it out.

imageimageThanks for your help!

Anne-Marie

Best answer by markatsafe

@amdubois​ For your Geodatabase reader, you might be able to formulate a SQL query to identify the geometry type. But I think the easiest solution is to just add a GeometryFilter after your FeatureReader's

View original
Did this help you find an answer to your question?

6 replies

Forum|alt.badge.img+2
  • Best Answer
  • January 14, 2022

@amdubois​ For your Geodatabase reader, you might be able to formulate a SQL query to identify the geometry type. But I think the easiest solution is to just add a GeometryFilter after your FeatureReader's


david_r
Evangelist
  • January 15, 2022

You can use the Schema (any format) reader to retrieve all the feature class definitions and filter by

fme_geometry{0} = fme_line

You can then send the feature class names in fme_feature_type_name to a FeatureReader to read the actual contents into FME.

 

This will work with most data formats, including File or Enterprise Geodatabase, Shape, etc. Just be aware that it might not work so well with formats such as (Geo)JSON, as there aren't any hard schema constraints on homogeneous geometry types per feature type.

 

If your source data contains a lot of non-line data, this could be much faster than using the GeometryFilter as you'll not be reading any non-line features into FME.


amdubois
  • Author
  • February 20, 2022

@david_r​ 

Thank you for your answer. I'm still having trouble with the Schema reader. I'm not sure when I would be supposed to input the filter query to extract only line geometry. Directly in the Schema reader or in the following FeatureReader? Or would I have to insert a Test tranformer in betweeen? Would I have to expose the fme_geomtry attribute?

 

read only line geometry, feature Reader parameter set example 

If you could add a picture that would really help me, thanks!


david_r
Evangelist
  • February 21, 2022
amdubois wrote:

@david_r​ 

Thank you for your answer. I'm still having trouble with the Schema reader. I'm not sure when I would be supposed to input the filter query to extract only line geometry. Directly in the Schema reader or in the following FeatureReader? Or would I have to insert a Test tranformer in betweeen? Would I have to expose the fme_geomtry attribute?

 

read only line geometry, feature Reader parameter set example 

If you could add a picture that would really help me, thanks!

Try something like this:

FGDB only read linesSee also the attached workspace template (FME 2020).

 


amdubois
  • Author
  • March 1, 2022

I ended using a geometry filter because it was easier than redoing my whole sequence but clearly the schema + tester is much simpler. Thank you all!


david_r
Evangelist
  • March 1, 2022
amdubois wrote:

I ended using a geometry filter because it was easier than redoing my whole sequence but clearly the schema + tester is much simpler. Thank you all!

I'd argue that the GeometryFilter is actually much simpler, but for some datasets it might be much slower. But for other datasets it might not make much of a difference, so both are equally valid solutions :-)


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