2

I've got a global DEM raster dataset in WGS84 and need to project this to all WGS84 UTM Zones. So after that I should have 120 raster, one in each Zone.

Is there a possibility to automate this process with the ArcMap ModelBuilder? I tried the "for" iterator, but I can't choose the epsg as iterating value.


Then I need to run the flow length tool on all those rasters and then reproject the resulting 120 flow length rasters again into WGS84.

Do you have any idea for an efficient way to create a ModelBuilder path for that?

4
  • Do you have a list of all epsg codes? Or know where it can be found?
    – Bera
    Commented Mar 28, 2018 at 11:26
  • Its the epsg 32601-32660 for the northern hemisphere and the epsg 32701-32760 for the southern hemisphere
    – David
    Commented Mar 28, 2018 at 11:37
  • You can find them on spatialreference.org . And it is the epsg 4326 for the WGS84.
    – David
    Commented Mar 28, 2018 at 11:40
  • @BERA (Im relatively new to this community so sorry for not linking you in the answer above)
    – David
    Commented Mar 28, 2018 at 11:49

2 Answers 2

2

I suggest you use Python for this. The code can be executed in the Python window of ArcGIS.

import arcpy, os

dem = r'C:\folder\dem.tif' #Change to match your DEM. Can also be a raster in a database
out_folder = r'C:\outfolder' #And this. If it is a database, remove .tif below

#List all UTM epsgs:
epsgs = range(32601,32661) + range(32701,32761)

#Project raster for each:
for epsg in epsgs:
    print 'Reprojecting to epsg: ',epsg
    arcpy.ProjectRaster_management(in_raster=dem, out_raster=os.path.join(out_folder,'Reprojected_epsg_{0}.tif'.format(epsg)), 
                                  out_coor_system=arcpy.SpatialReference(epsg))
5
  • 1
    Thank you very much @BERA . I try to learn python and arc py but I'm a beginner. But so this is a great cance to learn something new.
    – David
    Commented Mar 29, 2018 at 10:19
  • I tried to execute the script but I get the error message "The operation was attempted on an empty geometry"
    – David
    Commented Apr 5, 2018 at 9:56
  • 1
    @David Probably because your DEM is not covering the area of the UTM zone you are trying to Project it to. I just tried the code and it works when i Project it to a zone Close to the raster but fail with a zone far away from the raster.
    – Bera
    Commented Apr 5, 2018 at 13:38
  • Yes youre right. I wanted to try it out wit a little testing area, it was my fault. I've got one additional question: how do I have to change the script to implement it into the ModelBuilder like this?: desktop.arcgis.com/de/arcmap/10.3/analyze/modelbuilder/…
    – David
    Commented Apr 6, 2018 at 8:28
  • @David try following the instructions in the link. If you get stuck post a new question.
    – Bera
    Commented Apr 6, 2018 at 8:42
1

Even in this case, it's better to use Python. But you can use the ModelBuilder to do that after get a list of all the reference systems that you want to project to.

To get the list in a text file for all the reference systems, you can use arcpy as Bera mentioned [@BERA] and as follows:

#import modules
import arcpy

#set workspace
path = r"C:\reflist.txt"
file = open(path, 'w')
reference1 = range(32601,32661)
reference2 = range(32701,32761)
refList = reference1+reference2
print len(refList)
print refList
for ref in refList:
    print ref
    file.write(str(ref) + "\n")
file.close()
print "Script completed"   

Then import the list into ArcMap and export is as a table.

enter image description here

Then in a new Model, make it something like this:

enter image description here

For the (Iterate Field Values), choose your reflist table, ref field and define data type as coordinate system:

enter image description here

For the (Project Raster) tool, don't forget to define output name as (e.g Raster_%Value%.tif)

enter image description here

And then you can go further with other tools and processing.

7
  • 1
    @BERA I tried it with (project tool) for a vector layer and it works. I couldn't try it for the raster because the smallest raster I have around 1 GB on the size and I don't have enough space or resources for 120 rasters.
    – Moh
    Commented Mar 28, 2018 at 16:10
  • 1
    Thank you very much @User2009 this is really helpful. I will try it very soon.
    – David
    Commented Mar 29, 2018 at 10:16
  • I've followed your steps and tried to run the toolchain but I get the Error 000622 for invalid input at the coordinate system.
    – David
    Commented Apr 3, 2018 at 9:42
  • @David I retried checking it and it works properly. Did you define where you got this error? in the (project raster) or in another tool?
    – Moh
    Commented Apr 3, 2018 at 11:50
  • I get this Error in the Project raster tool. Also it and the following tools are stll white. The arc Map help says "not-ready-to-run (elements are white), it means that one or more input variables are invalid" (Source: desktop.arcgis.com/en/arcmap/10.3/analyze/modelbuilder/… ) @User2009
    – David
    Commented Apr 3, 2018 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.