Skip to main content

SpatialFilter gives more intersections than expected, any clue?

For a parcel I want to compute the area covered by buildings on that parcel. The start situation, with one parcel and some buildings.
 


My next plan was to use a SpatialRelator to create a list of buildings located at the yellow parcel.

I tested this approach using a SpatialFilter first to see whether the intersect function works. I expected to get back only the 2 red buildings within the parcel polygon. However, I got this:

A subpolygon of one the buildings is also selected. Did I something wrong?
​​​


My settings of the SpatialFilter:


Any ideas how to solve this? I tried other Predicates to test as well but so far no success.

 

One way to do this:

  • Generate _parcel_id.
  • Calculate _parcel_area.
  • Parcels & buildings into AreaOnAreaOverlayer.
  • Filter where _parcel_id has a value.
  • Filter where _overlaps = 1.
  • Calculate _parcel_area_no_buildings.

For this to work, no overlap is allowed in the parcels. If this is not the case, you will first need to relate buildings to parcels, to merge parcel id’s to buildings to be able to do a group by in the AreaOnAreaCalculator.

Parcels will end up with geometries wit buildings cut from it. To restore the original geometry I use a GeometryExtractor before the geometry is changed to get it to an attribute and a GeometryReplacer to restore the original geometry from this attribute. This way you won’t need a blocking FeatureMerger.

Attached sample workspace.


One way to do this:

  • Generate _parcel_id.
  • Calculate _parcel_area.
  • Parcels & buildings into AreaOnAreaOverlayer.
  • Filter where _parcel_id has a value.
  • Filter where _overlaps = 1.
  • Calculate _parcel_area_no_buildings.

For this to work, no overlap is allowed in the parcels.

Attached sample workspace.

Thanks! Will give it a try. I am still curious why I got these results from the SpatialFilter. Any idea? :)
@nielsgerrits 


Hard to say without data, but coordinates in fme are floating point precision, which means the vertices are not snapped on a grid. This probably causes a very tiny intersection between the parcel and the third building.


@nielsgerrits thanks for your solution. Works perfect. What would be the solution when I have multiple parcels and different buildings located at all of these parcels?


@nielsgerrits thanks for your solution. Works perfect. What would be the solution when I have multiple parcels and different buildings located at all of these parcels?

Not sure I understand what you mean. This approach can be used for multiple parcels and buildings, as long as the parcels are not overlapping.


@nielsgerrits thanks for your solution. Works perfect. What would be the solution when I have multiple parcels and different buildings located at all of these parcels?

Not sure I understand what you mean. This approach can be used for multiple parcels and buildings, as long as the parcels are not overlapping.


@nielsgerrits  Your approach was almost fine, thanks for sharing. I only faced a problem in case a parcel was split into different sections because of buildings which cut the parcels into different parts. I solved this using StatisticsCalculator, Sum of area for each parcel id (Group By)  = total area no building for that id


@nielsgerrits thanks for your solution. Works perfect. What would be the solution when I have multiple parcels and different buildings located at all of these parcels?

Not sure I understand what you mean. This approach can be used for multiple parcels and buildings, as long as the parcels are not overlapping.


@nielsgerrits  Your approach was almost fine, thanks for sharing. I only faced a problem in case a parcel was split into different sections because of buildings which cut the parcels into different parts. I solved this using StatisticsCalculator, Sum of area for each parcel id (Group By)  = total area no building for that id

An alternative is to use the Aggregator, this will merge the geometry in a aggregate / collection.


Reply