AnsweredAssumed Answered

Geoprocessing Package Only Returning Partial Data (WPF v100.2)

Question asked by keith.gemeinhart on Sep 10, 2018

The short version .... I have a geoprocessing package that uses DTED files to calculate slope > 5°, and returns a feature class. I can run it from inside ArcMap, but when I run it from my WPF app, I don't get all of the results.

 

I think my code is correct, because I can open the URL for the local server in a browser, the code runs, and I do get some results.

 

More details on the model ... The final few steps are:

1. Greater than Equal (inputs are slope raster in WGS84 and 5) so the result of that step is a logical slope raster with 2 values: 0 where slope is <5 and 1 where slope is >= 5.

2. Raster to Polygon (input is output from step 1)

3. Select (gridcode > 0; input is the polygon from step 2).

Final result is a feature with just the 1 values (i.e. slope is >= 5).

 

More details on the results in the WPF app .... If I include the Select step, the geoprocessing task runs to completion without error, but I get an empty results set. If I don't include the Select step, I get a single polygon that is just a rectangle of the results (and may also be the final record with 0 as the gridcode value).

gpk model

 

If I export the model to python, here is the resulting script:

 

 

 

# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# model.py
# Created on: 2018-09-10 10:40:00.00000
#   (generated by ArcGIS/ModelBuilder)
# Usage: model <TempMosaicName> <DtedFiles> <SelectedSlope> <LogicalSlope2> <AlmostFinalSlope>
# Description:
# xxx
# ---------------------------------------------------------------------------

 

# Set the necessary product code
import arceditor

 


# Import arcpy module
import arcpy

 

# Script arguments
TempMosaicName = arcpy.GetParameterAsText(0)
if TempMosaicName == '#' or not TempMosaicName:
    TempMosaicName = "keithtmo" # provide a default value if unspecified

 

DtedFiles = arcpy.GetParameterAsText(1)
if DtedFiles == '#' or not DtedFiles:
    DtedFiles = "C:\\@TerrainData\\Colorado-DTED\\DTED1_20120626121742\\W091\\N30.DT1;C:\\@TerrainData\\Colorado-DTED\\DTED1_20120626121742\\W091\\N31.DT1;C:\\@TerrainData\\Colorado-DTED\\DTED1_20120626121742\\W091\\N32.DT1" # provide a default value if unspecified

 

SelectedSlope = arcpy.GetParameterAsText(2)
if SelectedSlope == '#' or not SelectedSlope:
    SelectedSlope = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\SelectedSlope" # provide a default value if unspecified

 

LogicalSlope2 = arcpy.GetParameterAsText(3)
if LogicalSlope2 == '#' or not LogicalSlope2:
    LogicalSlope2 = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\LogicalSlope" # provide a default value if unspecified

 

AlmostFinalSlope = arcpy.GetParameterAsText(4)
if AlmostFinalSlope == '#' or not AlmostFinalSlope:
    AlmostFinalSlope = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\AlmostFinalSlope" # provide a default value if unspecified

 

# Local variables:
SLopeTesting_gdb = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb"
Mosaic_Dataset_Name = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\keithtmo"
LoadedMosaic = Mosaic_Dataset_Name
LoadedRaster = LoadedMosaic
ProjectedRaster = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\ProjectToWeb"
SlopeResult = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\SlopeResult"
SlopeAsWgs84 = "C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\SlopeAsWgs84"
Five = "5"

 

# Process: Create Mosaic Dataset
arcpy.CreateMosaicDataset_management(SLopeTesting_gdb, TempMosaicName, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]];-400 -400 1000000000;-100000 10000;-100000 10000;8.98315284119522E-09;0.001;0.001;IsHighPrecision", "", "", "NONE", "")

 

# Process: Add Rasters To Mosaic Dataset
arcpy.AddRastersToMosaicDataset_management(Mosaic_Dataset_Name, "DTED", DtedFiles, "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "NO_OVERVIEWS", "", "0", "1500", "", "*.dt0;*.dt1;*.dt2", "SUBFOLDERS", "ALLOW_DUPLICATES", "NO_PYRAMIDS", "NO_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE", "NO_STATISTICS", "")

 

# Process: Mosaic To New Raster
arcpy.MosaicToNewRaster_management("C:\\@Projects\\PAWTL-2\\maps\\SlopeGeoprocessing\\SLopeTesting.gdb\\keithtmo", SLopeTesting_gdb, "LoadedRaster", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "8_BIT_UNSIGNED", "", "1", "LAST", "FIRST")

 

# Process: Project Raster
arcpy.ProjectRaster_management(LoadedRaster, ProjectedRaster, "PROJCS['WGS_1984_Web_Mercator_Auxiliary_Sphere',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator_Auxiliary_Sphere'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],PARAMETER['Auxiliary_Sphere_Type',0.0],UNIT['Meter',1.0]]", "NEAREST", "100.473271265653 100.473271265653", "", "", "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]")

 

# Process: Slope
arcpy.gp.Slope_sa(ProjectedRaster, SlopeResult, "DEGREE", "1")

 

# Process: Project Raster (2)
arcpy.ProjectRaster_management(SlopeResult, SlopeAsWgs84, "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]", "NEAREST", "8.33334741286403E-04 8.33334741286403E-04", "", "", "PROJCS['WGS_1984_Web_Mercator_Auxiliary_Sphere',GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]],PROJECTION['Mercator_Auxiliary_Sphere'],PARAMETER['False_Easting',0.0],PARAMETER['False_Northing',0.0],PARAMETER['Central_Meridian',0.0],PARAMETER['Standard_Parallel_1',0.0],PARAMETER['Auxiliary_Sphere_Type',0.0],UNIT['Meter',1.0]]")

 

# Process: Greater Than Equal
arcpy.gp.GreaterThanEqual_sa(SlopeAsWgs84, Five, LogicalSlope2)

 

# Process: Raster to Polygon
arcpy.RasterToPolygon_conversion(LogicalSlope2, AlmostFinalSlope, "NO_SIMPLIFY", "VALUE")

 

# Process: Select
arcpy.Select_analysis(AlmostFinalSlope, SelectedSlope, "gridcode >  0")

Outcomes