AnsweredAssumed Answered

ArcGIS Server creates memory layer without user input

Question asked by wondim81_CIAT on Feb 12, 2018
Latest reply on Feb 14, 2018 by wondim81_CIAT

Dear Community, 

 

ArcGIS Server creates memory layer without input data. The problem happens, even though a shapefile is not uploaded to the JavaScript or the Server form, it creates most likely an empty layer which causes the following error. 

 

Submitted.
Executing...
Traceback (most recent call last): File "", line 1305, in updateParameters
File "..\arcgis\server\arcpy\arcpy\__init__.py", line 1138,
in ListFields return gp.listFields(dataset, wild_card, field_type)
File "..\arcgis\server\arcpy\arcpy\geoprocessing\_base.py", line 346,
in listFields self._gp.ListFields(*gp_fixargs(args, True)))
IOError: "in_memory\{740E488A-99B9-484E-BC61-486E2EFE17D0}" does not exist

 

Below is the code where the problem happens.


def updateParameters(self, parameters):
    """ Modify the values and properties of parameters before internal
        validation is performed.  This method is called whenever a parameter
        has been changed.
        Args:
            parameters: Parameters from the tool.
        Returns: Parameter values.
    """
   
   
# Set field values
    if parameters[7].value is not None and parameters[7].altered:
    
        if arcpy.Exists(parameters[7].value):
            in_fc_field = [f.name for f in
                           arcpy.ListFields(parameters[7].value,
                                           
field_type="String")]  # Get string field headers
            parameters[8].filter.list = in_fc_field  # Updated filter list
            if parameters[8].value is None:
                if len(in_fc_field) > 0:
                    parameters[8].value = in_fc_field[0] # Set initial field value

    else:
        parameters[8].filter.list = []  # Empty filter list
        parameters[8].value = ""  # Reset field value to None

Below is the request from JavaScript which does not include the input feature, which is allowed by the toolbox.

f:json
env:outSR:102100
in_raszone:{"url":"../africa_land_use.tif","format":"tif"}
in_raster1:{"url":"../africa_population_2010.tif","format":"tif"}
stat_type1:ALL
field_id1:ht
rec_option:EQUAL INTERVAL
num_classes:5

 

I am using ArcGIS Desktop 10.5 and ArcGIS for Servers 10.5

Outcomes