Hmm,
Does anyone know Tutorials that make it easier to start with ArcPy?
There are several workarounds that use only map algebra.
As a worked example let the origin be at (-500000, 0) and the cellsize be 10. Then[INDENT]xmap = (FlowAccumulation(1) + 0.5)*10 - 500000
ymap = (FlowAccumulation(64) + 0.5)*10
[/INDENT].
Bill, thank you very much for this!
I worked out a more detailed implementation of your idea here:
$$NCOLS + $$ROWMAP in ArcGIS 10 Python map algebra
Bill, thank you very much for this!
I worked out a more detailed implementation of your idea here:
[post]166151[/post]
Oops... there's a typo, and now it got quoted! The correct formula in the example is
[INDENT]xmap = (FlowAccumulation(1) + 0.5)*10 + 500000
[/INDENT](because one subtracts the coordinates of the origin instead of adding them).
This worked for me, for southern hemisphere (negative lat and lon). It is necessary to set the environmental options before running the script.
import numpy as np import arcpy from arcpy.sa import * from arcpy import env as E #Create variables from environment latmin = E.extent.YMin latmax = E.extent.YMax lonmin = E.extent.XMin lonmax = E.extent.XMax cellsize = float(E.cellSize) lowerleft = arcpy.Point(lonmin, latmin) #Generating inverse meshgrid for latitude grid lat1 = np.arange(float(-latmax), float(-latmin), float(cellsize)) lon1 = np.arange(float(-lonmax), float(-lonmin), float(cellsize)) lon1, lat1 = np.meshgrid(lon1, lat1) lat = arcpy.NumPyArrayToRaster(-lat1, lowerleft, float(cellsize), float(cellsize)) #Generating meshgrid for longitude grid lat2 = np.arange(float(latmin), float(latmax), float(cellsize)) lon2 = np.arange(float(lonmin), float(lonmax), float(cellsize)) lon2, lat2 = np.meshgrid(lon2, lat2) lon = arcpy.NumPyArrayToRaster(lon2, lowerleft, float(cellsize), float(cellsize))