Skip to main content
Question

How to do arcpy.SpatialJoin_analysis in FME?

  • November 16, 2017
  • 6 replies
  • 30 views

aguan
Supporter
Forum|alt.badge.img+11
  • Supporter
  • 140 replies

I am trying to replicate what these two ArcGIS APIs below do in FME, between a polygon and a point, and a polygon and a polygon respectively. 

Which FME transformers can do best this? I tried SpatialRelator for the 1st,  but it gives  a lot less records than the arcpy. The arcpy adds a polygon for each point. 

For example, BHP_WELL_PATH_BUFF_FC has 28 polygon, there are 91 points that fall into those polygons, so WELLS_FRAC_HITS_TEMP_FC duplicated some of the polygons to be 91 polygons, one for each polygon. The SpatialRelator only gives 28 polygons. It does not have the "JOIN_ONE_TO_MANY" ,"KEEP_COMMON", and  "KEEP_ALL" options.

arcpy.SpatialJoin_analysis(BHP_WELL_PATH_BUFF_FC,THIRD_PARTY_FC,WELLS_FRAC_HITS_TEMP_FC,"JOIN_ONE_TO_MANY","KEEP_COMMON"..

arcpy.SpatialJoin_analysis(WELLS_FRAC_HITS_TEMP_FC,PRODUCTION_UNIT_FC,WELLS_FRAC_HITS_PU,"JOIN_ONE_TO_MANY","KEEP_ALL"

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

6 replies

trentatsafe
Safer
Forum|alt.badge.img+6
  • Safer
  • 278 replies
  • November 16, 2017

Hello @ag

I believe SpatialRelator or the PointonAreaOverlayer/AreaonAreaOverlayer would be the transformers to use for your situation. The SpatialRelator will use the supplier to compare with your requestor(in your situation are you setting your Point or Polygon feature as the Requestor? As such, each feature's attributes will be added to the feature. It may be best to try switching your Requestor and Supplier ports to see if the results match closer to your Arcpy results.

 

 

Alternatively, as mentioned before the PointOnAreaOverlayer or AreaOnAreaOverlayer may work for your two workflows.

 

The documentation can be found here:

 

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/spatialrelator.htm

 

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/pointonareaoverlayer.htm?Highlight=pointonarea

 

 

I hope that helps.

aguan
Supporter
Forum|alt.badge.img+11
  • Author
  • Supporter
  • 140 replies
  • November 17, 2017

Hello @ag

I believe SpatialRelator or the PointonAreaOverlayer/AreaonAreaOverlayer would be the transformers to use for your situation. The SpatialRelator will use the supplier to compare with your requestor(in your situation are you setting your Point or Polygon feature as the Requestor? As such, each feature's attributes will be added to the feature. It may be best to try switching your Requestor and Supplier ports to see if the results match closer to your Arcpy results.

 

 

Alternatively, as mentioned before the PointOnAreaOverlayer or AreaOnAreaOverlayer may work for your two workflows.

 

The documentation can be found here:

 

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/spatialrelator.htm

 

http://docs.safe.com/fme/2017.1/html/FME_Desktop_Documentation/FME_Transformers/Transformers/pointonareaoverlayer.htm?Highlight=pointonarea

 

 

I hope that helps.
@trentatsafe. I tried reverse the requestor and supplier, not working. Also tried PointOnAreaOverlayer and Cliper. None of them gives 91 polygons, with one poygon for each contained point. Not sure how to use AreaOnAreaOverlayer for this case.

 


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • November 20, 2017

I think one solution here is to use a transformer that allows a list, then explode that list.

For example, use the PointOnAreaOverlayer and set the Attribute Accumulation parameters to generate a list for the polygon features. So now we have a set of polygons, each with a list of the overlapping points.

Redirect the output to the Data Inspector and query a feature and you will see the list I mean.

Now in Workbench connect this into a ListExploder transformer. Set the list to be exploded.

Now you will have one polygon for each point feature that overlapped.

Hope this helps.


mark2atsafe
Safer
Forum|alt.badge.img+56
  • Safer
  • 2554 replies
  • November 20, 2017

I think one solution here is to use a transformer that allows a list, then explode that list.

For example, use the PointOnAreaOverlayer and set the Attribute Accumulation parameters to generate a list for the polygon features. So now we have a set of polygons, each with a list of the overlapping points.

Redirect the output to the Data Inspector and query a feature and you will see the list I mean.

Now in Workbench connect this into a ListExploder transformer. Set the list to be exploded.

Now you will have one polygon for each point feature that overlapped.

Hope this helps.

pointonarealist.fmwt

 

 

Here's an example workspace. It looks for address points that fall inside a park, and outputs one park polygon for each address that falls inside it.

 


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • 2252 replies
  • November 20, 2017

Use a spatialrelator to get the polygon id's to the points.

Then to dupe the polygons to the points you then use the feature merger.

Have polygons (least nr of objects) to requestor, points (most nr of objects) to supplier.

( reverse is possible, but you will need to set process duplicates, a list and explode it. This wil not transport geometry, so you will need to reacquire them by merging again. (unless you put them into a geometry attribute))


aguan
Supporter
Forum|alt.badge.img+11
  • Author
  • Supporter
  • 140 replies
  • November 27, 2017

Look like using either SpatialRelator or PointOnAreaOverlayer in combination with ListExploder can do the trick. Thanks to you all.