Select to view content in your preferred language

Iteratively Shift Polygon Windows for Spatial Joins with Points (or Rasters?)

936
4
05-13-2022 07:16 AM
E_haus
by
Occasional Contributor

Hello, first time Community poster here looking for some help on a spatial analysis step.

I have a global dataset of 1-km land area data and would like to analyze it at 40-km resolution. I am trying to create a dummy variable data table made up of: 1) 1-km Point IDs and 2) 40-km Window IDs for a series of different window configurations.  Using Arcpy Notebook through ArcGIS Pro 2.8.3, I am running into several issues when trying to do this:

  1. Timing -- A Spatial Join between these points and windows takes 3.5 hours for one window configuration. I would like to run about 100 configurations. Would working with rasters be faster? If so, how might one perform a raster spatial join (intersect) to table?
  2. Shifting -- How does one shift the window a certain distance and direction? I have tried using the Shift tool but the unit is unclear and I am not using an equal-area projection. I also am considering creating a fishnet for each "window shift" iteration but worry about units and the projection as well.

Please let me know if you have any clarifying questions, as I know this is not the best description of my problem. I will try to edit this post as I try new things.

Thank you so much!

0 Kudos
4 Replies
curtvprice
MVP Esteemed Contributor

Working with rasters would dramatically faster. Just considering the point 1km dataset, well, I'm surprised you managed to create a polygon dataset that large in a reasonable time frame. Raster overlay is very fast because you all overlays are using simple row-column locations - MUCH faster than the spatial search required for each point spatial join. Your 1km points run against a 40 km raster with Extract Value to Points would be dramatcially faster than a spatial join.

You could create a 40 km window (averaged?) using the Aggregate tool.

A piece of advice - work on a subset of a small part of the world and verify your workflow  is doing what you want - this will save a lot of time.  You are correct that coordinate system is very important to get valid results with regional or global datasets.

E_haus
by
Occasional Contributor

Thank you very much for your response!

I agree and have now tested it, working with rasters is faster, and will use Extract Multi Values To Points to extract my 40-km Window IDs to the 1km points.

Now there is the second question remaining, how do I create these different configurations of the 40-km windows? I have one version created using the Aggregate tool which I used to train my model. But now, I would like to take more of a fishnet approach so that when I shift the windows there are no 1-km cells lost outside of the 40-km window extent. I have successfully created a 40-km rectangular fishnet (raster) that covers the global extent, but is there a method that you suggest for iteratively shifting this layer?

Thank you again! All the best!

0 Kudos
curtvprice
MVP Esteemed Contributor
I don't think a fishnet (lots of polygons!) is necessary, aggregate will place where you want if you set the raster processing cell size to 1km set the factor to 40, and set the extent x1 y1 x2 y2 explicitly where you want the lower left corner to go.
0 Kudos
E_haus
by
Occasional Contributor

Thank you again for your timely response! I am unsure on how to use aggregate for the purpose that you suggested, but can accept the extra time it takes to rasterize a fishnet so that I achieve the desired full coverage and distinct raster values.

Please see the snip below of a subset of my 1-km raster data points with overlaid 40-km windows. For use in Extract Values to Points, this is a raster but I wanted to visualize it as polygon. I can do one iteration of the extraction, but the remaining challenge for me is shifting the 40-km layer iteratively so that each time I run Extract Values to Points, a slightly different set of 1-km points is assigned to each 40-km raster window. I have tried several things but keep running into dead ends when it comes to the shift. Please let me know if you would like further clarification. Thank you!

EmmaHouse_1-1652720678187.png

 

 

0 Kudos