Solved

Combine Featurereader and neighborfinder

  • 5 January 2016
  • 6 replies
  • 1 view

Badge +1
Combine Featurereader and neighborfinder
icon

Best answer by erik_jan 6 January 2016, 16:55

View original

6 replies

Badge +1

I have a shapefile with polygons which I want to find the nearest neighbour from a postgis database of points. If the postgis database was in shapefile I would use the neighborfinder but I want to be more efficent and query the Postgis to find the nearest neighbour.

Is there a way of combining the two together in FME?

Userlevel 2
Badge +12

If you mean: Find the objects in an area surrounding a point objects, you can use the Bufferer to create a circle of interest and feed that to the FeatureReader. That way you will read the objects in a radius from the point object.

Badge +1

It is the other way round. I have a polygon which I want to find which is the nearest point and then take the attributes from that point. e.g. a boundary of a property I want to find the nearest postcode point (Codepoint) to the polygon and then take the postcode from the point.

The codepoint is in a postgis database.

Rather than reading the entire postgis database in as a reader and then using the neighborfinder to do find the nearest point I wanted to use featurereader to streamline the process.

Userlevel 2
Badge +12

So, if you want to select only those points from the PostGis database that are within or close to a polygon you want to enlarge the polygons by a margin (using the Bufferer) and use those polygons as Initiator for the FeatureReader to read the points. For performace reasons you might even want to replace the polygons by bounding boxes before enlarging them (using BoundingBoxReplacer).

Userlevel 4
Badge +25

So, if you want to select only those points from the PostGis database that are within or close to a polygon you want to enlarge the polygons by a margin (using the Bufferer) and use those polygons as Initiator for the FeatureReader to read the points. For performace reasons you might even want to replace the polygons by bounding boxes before enlarging them (using BoundingBoxReplacer).

Yes, I think it will be a two-step process (get near features with the buffer search then use a NeighborFinder). It is an interesting idea to combine the two - and perhaps you could suggest that in the ideas pages to see if it picks up votes from other users.

Userlevel 2
Badge +12

Yes, I think it will be a two-step process (get near features with the buffer search then use a NeighborFinder). It is an interesting idea to combine the two - and perhaps you could suggest that in the ideas pages to see if it picks up votes from other users.

@Mark2AtSafe and @sebkingsley: I will add the "Find the nearest object" as a Spatial filter to the FeatureReader as an idea.

Reply