- Notifications
You must be signed in to change notification settings - Fork85
-
I'm unable to run the AStar finder algorithm on a TIF cost raster file. img_arr = xa.open_rasterio(url_raster2).squeeze().drop("band")` `start = img_arr[20][10] end = img_arr[2000][2000] path_agg = a_star_search(img_arr, start = (start_y, start_x), goal = (end_y, end_x))` What can be the possible issue ?. I am trying to run xarray-spatial in the hope that i get some performance improvements in by using Dask and Numba. Will this be achievable with the current development and if not are there any plans to deploy the same in the future? |
BetaWas this translation helpful?Give feedback.
All reactions
Replies: 1 comment 3 replies
-
Thanks for reaching out on this. I've looked into the code and found an issue in start=img_arr[20][10]start_y=int(start.coords['y'].data)start_x=int(start.coords['x'].data)end=img_arr[2000][2000]end_y=int(end.coords['y'].data)end_x=int(end.coords['x'].data)path_agg=a_star_search(img_arr,start= (start_x,start_y),goal= (end_x,end_y))` Currently, xarray-spatial pathfindind a star already supports Numba. We plan to support Dask for all the tools in the library ( |
BetaWas this translation helpful?Give feedback.
All reactions
-
I've tried reversing the order of x & y but that doesn't really help. I still get the same error. An example of pathfinding implementation is shown using a shape file along with Geopandas but not with rasterio and a raster file. I'm glad to know that A star path finder already supports Numba but it will do a great deal of help if it's able to process data from a raster |
BetaWas this translation helpful?Give feedback.
All reactions
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
-
The start and end locations should map to the exact pixels on the image by default. Can you set path_agg=a_star_search(img_arr,start= (start_x,start_y),goal= (end_x,end_y)),snap_start=True,snap_goal=True It would snap the start and goal location to the nearest valid value before beginning pathfinding. Current implementation supports 2D xarray DataArray raster I believe. Can you post the full error messages if it doesn't work? |
BetaWas this translation helpful?Give feedback.
All reactions
-
Okay, just tried the same data and run the function myself. It seems the function to check whether a location is inside the raster does not work well at the moment. I'll create a pull request to fix this. Thanks again! |
BetaWas this translation helpful?Give feedback.
All reactions
👍 1