Solved

How can I count crossings of roads and waterways?


I have two datasets from OSM for a small region: roads and waterways. I want to count the "bridges" resp. all kinds of crossings between roads and waterways in FME. I can't find the right Transformer to do this (or I just don't see the right options if I already found a suitable transformer). I tried e.g. "Intersector", "LineOnLineOverlayer", "SpatialFilter". Maybe I'm just missing a small detail. What Transformer and options should I use?

 

I got helpful hints here at gis.stackexchange.com, saying that I could use an Intsersector, a ListHistogrammer and a Tester. Unfortunately, this does not work for me:

 

O3xBw 

In the two respective Readers with OSM data I exposed the fme_basename attribute and use it for list generation. However, the Tester does not detect the correct nodes when I check if the histogram{0}.count equals 2.

 

What am I doing wrong? Or is there even another, much simpler way to count the crossings between two feature layers? Thanks for your help.

 

 

icon

Best answer by DanAtSafe 31 August 2022, 01:16

View original

4 replies

Userlevel 2
Badge +11

@winnewoerp​ What are the two values for fme_basename? They will be the same if from the same file, even with two OSM readers. If the feature type is exposed (and unique for water or roads) then use that instead in the ListHistogrammer.

@winnewoerp​ What are the two values for fme_basename? They will be the same if from the same file, even with two OSM readers. If the feature type is exposed (and unique for water or roads) then use that instead in the ListHistogrammer.

@danatsafe​ gis_osm_roads_free_1 and gis_osm_waterways_free_1 (like the two file names) are the two different values of fme_basename. fme_feature_type outputs the same (I just exposed it for testing).

Userlevel 2
Badge +11

@danatsafe​ gis_osm_roads_free_1 and gis_osm_waterways_free_1 (like the two file names) are the two different values of fme_basename. fme_feature_type outputs the same (I just exposed it for testing).

_histogram{0}.count will equal 2, assuming that a road or waterway was split in 2 by the the other feature type. There's a chance that your intersections don't always split 2 features into 4. A safer solution would be to use a ListElementCounter on _histogram{}. Where the element count is 2, then the ListHistogrammer had found 2 unique values for lines{}.fme_basename.

@danatsafe​ gis_osm_roads_free_1 and gis_osm_waterways_free_1 (like the two file names) are the two different values of fme_basename. fme_feature_type outputs the same (I just exposed it for testing).

Thank you, the solution using a ListElementCounter worked perfectly. Now the workflow looks like this (including the test of the written Shapefile in QGIS):

 

Screenshot 2022-08-31 073525Screenshot 2022-08-31 073248

Reply