Disclaimer: I'm new to GIS
Goal: Create a report of how many customers we have in each senate district.
Progress: I found this utility from the state of Missouri which allows me to search for an address and it displays the corresponding district. I did some debugging and found that it looks like it is doing two calls to an ArcGIS server (Using Branson, MO as example):
{ "spatialReference": { "wkid": 102100, "latestWkid": 3857 }, "candidates": [ { "address": "Branson, Missouri, United States", "location": { "x": -10377036.95984281, "y": 4389554.630050001 }, "score": 100, "attributes": {...}, "extent": { "xmin": -10383716.235155277, "ymin": 4381233.546051718, "xmax": -10370357.896260085, "ymax": 4397882.30382274 } } ]}The second call returns a list of result objects:
{ "results": [ { "layerId": 1, "layerName": "Senate District", "displayFieldName": "District", "value": "29", "attributes": { "OBJECTID": "29", "District": "29", "Population": "181191", "webLink": "http://www.senate.mo.gov/15info/members/mem29.htm", "photoLink": "http://www.senate.mo.gov/15info/graphics/d29-photo.gif", "Name": "David Sater", "Shape": "Polygon", "District_Number": "29", "Shape.area": "8040296221.235743", "Shape.len": "505379.224253" }, "geometryType": "esriGeometryPolygon", "geometry": {} } ]}attributes.district being the value I want.
As you can see above, the second call sends a parameter called geometry which is a combination of location and spatialReference, as well as mapExtents which is a combination of extent and spatialReference. It also sends some other things.
The point is, this seems to require a lot of object/string manipulation to do both calls. The question is, are both calls necessary? Is there another way to call /identify, perhaps directly with latlng which I already have? I've looked at the documentation and I don't see anything, but to be honest I don't even understand what mapExtent is or why I need it. Why would it be different for every point I query?
Any tips would be appreciated.
أكثر...
Goal: Create a report of how many customers we have in each senate district.
Progress: I found this utility from the state of Missouri which allows me to search for an address and it displays the corresponding district. I did some debugging and found that it looks like it is doing two calls to an ArcGIS server (Using Branson, MO as example):
- https://geocode.arcgis.com/arcgis/r...rver/findAddressCandidates?SingleLine=branson, mo&f=json&outSR={"wkid":102100,"latestWkid":3857}&outFields=*
- https://ogi.oa.mo.gov/ArcGIS/rest/services/LEGIS/legisDistrict/MapServer/identify?f=json&geometry={"x":-10377036.95984281,"y":4389554.630050001,"spatialReference":{"wkid":102100,"latestWkid":3857}}&tolerance=1&returnGeometry=true&mapExtent={"xmin":-10377151.615385238,"ymin":4389439.974507573,"xmax":-10376922.304300383,"ymax":4389669.285592428,"spatialReference":{"wkid":102100}}&imageDisplay=1599,845,96&geometryType=esriGeometryPoint&sr=102100&layers=visible:1
{ "spatialReference": { "wkid": 102100, "latestWkid": 3857 }, "candidates": [ { "address": "Branson, Missouri, United States", "location": { "x": -10377036.95984281, "y": 4389554.630050001 }, "score": 100, "attributes": {...}, "extent": { "xmin": -10383716.235155277, "ymin": 4381233.546051718, "xmax": -10370357.896260085, "ymax": 4397882.30382274 } } ]}The second call returns a list of result objects:
{ "results": [ { "layerId": 1, "layerName": "Senate District", "displayFieldName": "District", "value": "29", "attributes": { "OBJECTID": "29", "District": "29", "Population": "181191", "webLink": "http://www.senate.mo.gov/15info/members/mem29.htm", "photoLink": "http://www.senate.mo.gov/15info/graphics/d29-photo.gif", "Name": "David Sater", "Shape": "Polygon", "District_Number": "29", "Shape.area": "8040296221.235743", "Shape.len": "505379.224253" }, "geometryType": "esriGeometryPolygon", "geometry": {} } ]}attributes.district being the value I want.
As you can see above, the second call sends a parameter called geometry which is a combination of location and spatialReference, as well as mapExtents which is a combination of extent and spatialReference. It also sends some other things.
The point is, this seems to require a lot of object/string manipulation to do both calls. The question is, are both calls necessary? Is there another way to call /identify, perhaps directly with latlng which I already have? I've looked at the documentation and I don't see anything, but to be honest I don't even understand what mapExtent is or why I need it. Why would it be different for every point I query?
Any tips would be appreciated.
أكثر...