Saturday 26 September 2015

arcgis desktop - Project raster tool stays white at iteration in ModelBuilder?


I want to project a bunch of rasters (WGS84) to different UTM (WGS84) coordinate systems. The coordinate system depends on a field value of a point shape.


So on each raster lays a point with its spatial reference.


I scripted a little ModelBuilder toolchain for it but unfortunately the Project raster Tool stays white and doesn't execute.


enter image description here


Some detail information for the toolchain:


I extract the information wich point lays on the individual raster with the sample tool. Then I get for each raster a table with many no data points and one with the stored EPSG Information. This point is extracted by the table select tool and then I get the EPSG with the get field value tool and store it as spatial reference.


The spatial reference I use as Output coordinate system. But the Project raster tool requires the "optional" Geographic Transformation although both coordinate systems use the WGS84 referece.



enter image description here Tool Dialog of Create spatial reference



  • I tested the toolchain until the projection part and there is no error.

  • I've checked if the rasters lay in the UTM zone I want to project them to.

  • When I run the tool first, then disconnect the spatial reference and the Projection and then reconnect, the tool gets colorful. But when I run the toolchain again (without validation) only one Raster is projected several times to the same coordinate system until I cancel it.

  • at no point any error message occurs when running the tool

  • I've changed the data type of the field value to "Coordinate System" with no effect



Answer



It seems like an Error of the Project Raster tool itself. When I use the ArcPy script of the Esri page and change it a bit to insert the parameters and load this script tool to my model it works perfectly. No error message and no white tool.



import arcpy
from arcpy import env

Input_Raster = arcpy.GetParameterAsText(0)
Output_Raster = arcpy.GetParameterAsText(1)
Output_Coord = arcpy.GetParameterAsText(2)

arcpy.ProjectRaster_management(Input_Raster, Output_Raster,Output_Coord, "BILINEAR")

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...