AnsweredAssumed Answered

Map Svc Identify Task vs. Geoprocessing Svc SelectByLoc

Question asked by jamesfreddyc on Feb 11, 2016

I'm putting this question here but it's a hybrid/mix of a AGS service layer's Identify task compared to creating my own Geoprocessing service that accomplishes the same thing.

 

We've experienced poor performance with a custom JavaScript API application that utilizes the Identify task to return JSON output.  An editable polygon FeatureService allows a user to define an area and then this feature is used in an Identify process on a point Feature Service containing approx. 85 million features.

 

Can someone explain why I seem to experience better performance with the python code published as a Geoprocessing service compared to the above Identify task?

 

    fc2 = arcpy.CreateFeatureclass_management('in_memory', 'tmpFC', "POLYGON")        
       with arcpy.da.InsertCursor(fc2, ['SHAPE@']) as cur:
           cur.insertRow([polygon])

    pnt_fc = r'<some FeatureClass in a FGDB registered in AGS>'
    arcpy.MakeFeatureLayer_management(pnt_fc, "PointFeatures")

    #perform the selection 
    arcpy.SelectLayerByLocation_management("PointFeatures", "COMPLETELY_WITHIN", fc2)

    #count rows to include as attribute in output JSON string
    rowcount = int(arcpy.GetCount_management("PointFeatures").getOutput(0))
    
    newlist = []
    with arcpy.da.SearchCursor("PointFeatures",['OID@', '_Code1','_Code2','SoilID','SHAPE@X', 'SHAPE@Y']) as sc:
        for row in sc:
            values = {'layerId': '',
                      'count': rowcount,
                      'layerName': '',
                      'displayFieldName': '',
                      'value': '',
                      'attributes':{'OBJECTID': row[0],
                                    'Shape': '',
                                    '_Code1': row[1],
                                    '_Code2': row[2],
                                    'SoilID': row[3]},
                      'geometryType': '',
                      'geometry': {'x': '',
                                   'y': '',
                                   'spatialreference': {'wkid': '',
                                                        'latest': ''}
                                   }
                      }
            
            newlist.append(values)      
             
    data['_Output'] = newlist

    #output JSON parameter
    arcpy.SetParameterAsText(1, json.dumps(data))

 

 

 

The native Identify task that has been configured on the Map Service takes 10's of minutes to complete, while the GP service version completes in roughly 2 minutes for the same input selecting polygon feature used in the process.

 

Is there likely a problem with the configuration of the Identify on the Map Service?  I'd like to understand why my GP service performs better.

Outcomes