AnsweredAssumed Answered

ArcGIS REST API find nearest example

Question asked by waringt on Feb 8, 2018
Latest reply on Feb 9, 2018 by waringt

Greetings, I'm trying to build a find nearest tool that uses the REST API to perform a Find Nearest analysis. Right now I'm working in the service directory form to get some simple results. From there I'll integrate into an http call from a Java application. 

 

I'm walking through the documentation to build out a simplified example and entering the information into the html form (accepting most of the defaults) as such: 

 

analysisLayer: 

 

{
   "layerDefinition": {
      "geometryType": "esriGeometryPoint",
      "fields": [{
         "name": "OBJECTID",
         "type": "esriFieldTypeOID",
         "alias": "OBJECTID"
      }]
   },
   "featureSet": {
      "geometryType": "esriGeometryPoint",
      "spatialReference": {
         "wkid": 4326
      },
      "features": [{
         "geometry": {
               "x": -78.78227,
               "y": 35.78691
         },
         "attributes": {
            "OBJECTID": 1
         }
      }]
   }
}

nearLayer: 

 

  {
      "layerDefinition": {
            "geometryType": "esriGeometryPoint",
            "fields": [
            {
                  "name": "OBJECTID",
                  "type": "esriFieldTypeOID",
                  "alias": "OBJECTID"
            }
            ]
      },
      "featureSet": {
            "geometryType": "esriGeometryPoint",
            "spatialReference": {
                  "wkid": 4326
            },
      "features": [
      {
            "geometry": {
                  "x": -78.78845,
                  "y": 35.79748
      },
            "attributes": {
                  "OBJECTID": 1
      }
   },
   {
         "geometry": {      
                 "x": -78.79154,
                  "y": 35.78691
         },
         "attributes": {
               "OBJECTID": 2
         }
   },
   {
         "geometry": {
               "x": -78.78604,
               "y": 35.78272
         },
         "attributes": {
               "OBJECTID": 3
         }
   },
   {
         "geometry": {
               "x": -78.77162,
               "y": 35.79192
         },
         "attributes": {
               "OBJECTID": 4
         }
   },
   {
         "geometry": {
               "x": -78.77541,
               "y": 35.78774
         },
         "attributes": {
               "OBJECTID": 5
         }
   }
]
}
}

 

measurementType: 

   

   StraightLine

 

MaxCount: 

 

   100

 

searchCutoff: 

   

   5000

 

searchCutoffUnits:

   

   Meters

 

timeOfDay: 

 

   null

 

timeZoneForTimeOfDay: 

 

   GeoLocal

 

 

I'm getting cryptic errors upon clicking the Submit Job (POST) button: 

 

  • esriJobMessageTypeError: {"messageCode": "AO_100030", "message": "FindNearest failed."}
  • esriJobMessageTypeError: Failed to execute (FindNearest).
  • esriJobMessageTypeError: Failed.

 

I'm assuming that there are some details that are expected from my analysisLayer and nearLayer JSON objects. However, I am unable to determine why the process failed from the error message. Does anyone recognize any issue with my JSON objects or is there a way that I can access a more detailed error message? 

 

Thanks, Tyler 

Outcomes