ArcGIS Server Rest API Query - Multipoint

5504
6
10-27-2015 11:31 AM
JenniferAnderson1
New Contributor

Hello,

This is my first post to the ESRI forums but I am hoping there is someone out there that can assist me. I am a developer/database administrator, not a GIS professional so please be patient with my lack of GIS knowledge.

I am working on a project where I need to geocode around 20 million addresses and then take the latitude/longitude and query additional information for these addresses like Senate and Congressional districts, county and school district. After these addresses are complete, several times a year I need to process an addition 7-8 million addresses. Since this is an ongoing job with a fairly large amount of data I want this to be an automated process. I am writing C# code to interact with the ArcGIS Server Rest API to complete this task.

The geocoding was fairly easy, I’m sending batches of addresses to the geocode server that was made available by our GIS guys and when
the results come back I get a resultID back which is my unique identifier for each record. Here is a sample of the JSON string I send in to my code:

{records:[{attributes:{OBJECTID:1134,Address:123 Test St,City:Testville,Region:PA,Postal:12345}};{attributes:{OBJECTID:294302,Address:12 Fake Rd,City:Some
Town,Region:PA,Postal:54321}};]}

GeocodingCode.png

The problem I am running in to is when I try and query additional information (like school district in this example) for the returned
latitudes and longitudes. I can get it to work if I send the latitude/longitude one at a time using esriGeometryPoint for the Geometry Type. But this would require me to make 20 million calls to the ArcGIS server and I really want to avoid that. It would be much faster if I could send batches of lat/long points to the server like I did for the geocoding. I had some success changing the Geometry Type to esriGeometryMultipoint and I do get multiple records back but I cannot find a way to pass in and return a unique identifier for me to know which returned school district goes with which latitude/longitude. Also, if I happen to pass in an invalid lat/long it skips this record so my return count is different than the number of records I sent in.

Even if there was no unique identifier available, I could work with the original lat/long that was sent in. Unfortunately, this is not returned either. Here is my code and a sample string of lat/longs for the strLatLongCollection variable:

[-77.1111236737177,40.3156937711517],[-75.8130555653613,40.1077510928398]

QueryCode.png


Here is a sample of my returned data when I ask for all columns to be returned. Neither the “ID”, “OBJECTID” or “IU_NUM” are helpful.
They all relate to the returned school district, and not the lat/long I sent to the server.

FeatureResults.png

I also tried returning the geometry with the results. I’m not sure what “rings” are but none of the values are associated to the lat/long I sent to the server.

GeometryResults.png

I just need a way to associate the results with the records I sent to the Rest API query. Am I going about this wrong or perhaps missing something? I would so appreciate some help.

6 Replies
ChrisSmith7
Frequent Contributor

I am also using .NET to make a call to the REST service and need to perform the associations in batch... A multipoint feature sent is considered one "multi-part" feature, so the API doesn't really care how the results are returned, i.e. the multipoint parts (individual lat/longs) are not associated with their respective features returned by the API. I can think of some pseudobatch methods, but anyone with ideas to get the associated lat/long part returned with the API, I'm all ears! And eyes...

0 Kudos
RudyProsser
Esri Contributor

Jennifer,

What you're describing is a classic spatial analysis problem. Have you looked at Overlay Layers on the Spatial Analysis Service? You could submit your feature collection with point geometry as the inputLayer, the school districts as the overlayLayer, and set the overlayType to Intersect. The output points would contain the attributes of both the input and overlay layers.

-Rudy

0 Kudos
JenniferAnderson1
New Contributor

Hello Rudy,

    Thanks for replying to my post. I will try out the Overlay Layers and let you know how it works out. Thanks again, I really appreciate the help!

-Jen

0 Kudos
Vidar
by
Occasional Contributor II

@RudyProsser  Can this be done with a Feature Layer hosted in ArcGIS Online?

0 Kudos
RudyProsser
Esri Contributor

Vidar,

Yes, the inputs to Overlay Layers are the URLs to feature layers. You can run the analysis from Analysis in the Map Viewer Classic with your two layers added to the map.

+Rudy

0 Kudos
Vidar
by
Occasional Contributor II

Ideally I want to issue rest requests via C# - and send my geometry along as the input - can that be done? If so do you have any links to docs or example code?

0 Kudos