I'm trying to reproject a shapefile from the coordinate system of a raster used as model input in the model builder.
Like this:Raster(several coordinate systems)-> convert to Shapefile->project to a specific Coordinate System-> interact with another data-> reproject Shapefile (Back to the original coordinate system)
The problem is in the last step and is very similar to this:
Using the projection of a layer variable to project another in Model Builder in ArcGIS
The answer in that case was:
1 - In model builder, connect your raster dataset as precondition to the Calculate Value tool
2 - Within the Calculate Value tool's code block, add this
def rasterPrj(raster): return arcpy.Describe(raster).spatialReference3 - Set the Data Type as Spatial Reference
4 - Type this in the expression rasterPrj("%inRas%")
I made several attempts, but:
Thanks.
أكثر...
Like this:Raster(several coordinate systems)-> convert to Shapefile->project to a specific Coordinate System-> interact with another data-> reproject Shapefile (Back to the original coordinate system)
The problem is in the last step and is very similar to this:
Using the projection of a layer variable to project another in Model Builder in ArcGIS
The answer in that case was:
1 - In model builder, connect your raster dataset as precondition to the Calculate Value tool
2 - Within the Calculate Value tool's code block, add this
def rasterPrj(raster): return arcpy.Describe(raster).spatialReference3 - Set the Data Type as Spatial Reference
4 - Type this in the expression rasterPrj("%inRas%")
I made several attempts, but:
Executing (Calculate Value): CalculateValue rasterPrj("%inRas%") "def rasterPrj(raster):\n return arcpy.Describe(raster).spatialReference" "Spatial Reference" Start Time: Sat Aug 22 12:32:47 2015 ERROR 000539: Error running expression: rasterPrj("%inRas%") Traceback (most recent call last): File "", line 1, in File "", line 2, in rasterPrj File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy__init__.py", line 1234, in Describe return gp.describe(value) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\geoprocessing_base.py", line 374, in describe self._gp.Describe(*gp_fixargs(args, True))) IOError: "%inRas%" does not exist
Failed to execute (Calculate Value). Failed at Sat Aug 22 12:32:47 2015 (Elapsed Time: 0.16 seconds)
Could someone give a helping hand.Failed to execute (Calculate Value). Failed at Sat Aug 22 12:32:47 2015 (Elapsed Time: 0.16 seconds)
Thanks.
أكثر...