Skip to main content

Hello,

In one table in my database I have some polygons (lets say covering cities) with their names. In other tables I have some other features(geometries together with attributes).

Now I would like the flow like that:

1. Pass publish parameter as city name.

2. get all features from other tables (for example schools) but only which are inside specified city

3. spatial filter can't be (contains) because I also want to have school presented on the attached image

4. My idea was to get the central point for each school, then test if it is inside given polygon and if yes then add it to the result.

My idea was to do it this way:

1. feature reader for cities with filter applied

2. feature reader for schools - end now the problem, should I apply the spatial filter here or is it impossbile?

Now how to test if the center of given school is inside that city?

I don't know how to combine it all together. Thanks for any hints on that. cheer!

Can't you simply use the spatial predicate INTERSECTS rather than CONTAINS?


Can't you simply use the spatial predicate INTERSECTS rather than CONTAINS?

I don't think so because for example I don't want this school to be put into result (school_out)

 

 

 

 


You only want schools that have their centroid inside the city?

Convert your schools to points with CenterPointReplacer and after you use SpatialFilter with CONTAINS.


You only want schools that have their centroid inside the city?

Convert your schools to points with CenterPointReplacer and after you use SpatialFilter with CONTAINS.

Ok but I would like to have original polygons in the result so I have to get them back from DB? I don't know how to set up the flow :/

 

 


Ok but I would like to have original polygons in the result so I have to get them back from DB? I don't know how to set up the flow :/

 

 

Yeah you could get the polygons back with a FeatureMerger

 

 


Yeah you could get the polygons back with a FeatureMerger

 

 

Another alternative is to use the GeometryExtractor to save the polygon geometry as an attribute, then use the GeometryReplacer to get it back later on.

Be aware that a centre-point is not always the same as mostly in. There can be weird shaped schools in weird shaped city's where the centre-point of the building is inside the city, but the building itself is not in the city at all. This could be the case with L or C shaped buildings. But you have to see for yourself if this is a problem in your area.

I think i would start with a Contains filter to filter out the 90% that is totally within the city. Then you could calculate the % of area that is within the city to figure out the rest. This could be done with an GeometryExtractor - AreaCalculator - AreaOnAreaOverlayer - AreaCalculator - Tester (Divide Area2/Area1) - GeometryReplacer.

But maybe this is overkill to your problem.