1

I am trying to use one of the US Social Security Administration's APIs, which is an ArcGIS REST service API. It looks extremely powerful, but overwhelming with how complex it is. I am hoping for an example for a simple query.

I am using Python but might just construct the API using the Requests module rather than learning a new library, so I don't need Python specific info.

Here is the endpoint: http://services6.arcgis.com/zFiipv75rloRP5N4/ArcGIS/rest/services/Office_Points/FeatureServer/1

My goal is to be able to tell an SSA recipient where the nearest 2-3 offices are, based on their address, which can be geocoded to latitude/longitude if necessary (it would be great to use the ArcGIS API for that too. Otherwise, I'm within the free tier of Google's geocoding API). I successfully queried to obtain the office matching a zip code, but it looks like I can provide a Geometry of type Point (lat/lng?) and find offices within a set distance. I'm just not understanding how to provide the information to the API nor where to find this in the documentation.

Quinten
  • 113
  • 5

1 Answers1

1

The Query

http://services6.arcgis.com/zFiipv75rloRP5N4/ArcGIS/rest/services/Office_Points/FeatureServer/1/query?where=&objectIds=&time=&geometry=-96.915919%2C32.693022&geometryType=esriGeometryPoint&inSR=4326&spatialRel=esriSpatialRelIntersects&resultType=none&distance=100&units=esriSRUnit_StatuteMile&returnGeodetic=false&outFields=*&returnGeometry=true&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=4326&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnDistinctValues=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&having=&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&returnExceededLimitFeatures=true&quantizationParameters=&sqlFormat=none&f=pgeojson&token=

Will give you all the nearest locations from a location in Dallas within 100 miles (https://www.google.com/maps/@32.6946791,-98.0367294,8z)

Here is a result (in GeoJSON)

{
"type": "FeatureCollection",
"crs": {
"type": "name",
"properties": {
"name": "EPSG:4326"
}
},
"features": [
{
"type": "Feature",
"id": 87,
"geometry": {
"type": "Point",
"coordinates": [
-96.8742972731206,
32.6639134113369
]
},
"properties": {
"OBJECTID": 87,
"OCD": "853",
"EFF_STDT": 1441238400000,
"EFF_ENDT": 253402214400000,
"ADDRLN_1": "SOCIAL SECURITY       ",
"ADDRLN_2": "2475 CLIFF CREEK      ",
"ADDRLN_3": "CROSSING              ",
"ADDRLN_4": "                      ",
"CITY_NM": "DALLAS                      ",
"ST_CD": "TX",
"ZIP5": "75237",
"ZIP4": "3867",
"LATITUDE_NUM": 32.663913,
"LONGITUDE_NUM": -96.874297,
"INSRT_TS": 1441277702000,
"LU_TS": 1441277702000,
"OFC_OPEN_SW": "T",
"OfficeType": "FO/1",
"OfficeCode": "853",
"OfficeName": "DALLAS OAK CLIFF TX",
"AddressLine1": "SOCIAL SECURITY",
"AddressLine2": "2475 CLIFF CREEK",
"AddressLine3": "CROSSING",
"City": "DALLAS",
"State": "TX",
"Zip5_1": "75237",
"PhoneType": "BUS",
"BusinessPhone": "8007721213",
"MON_OPEN_TM": "9:00 AM",
"MON_CLOS_TM": "4:00 PM",
"TUE_OPEN_TM": "9:00 AM",
"TUE_CLOS_TM": "4:00 PM",
"WED_OPEN_TM": "9:00 AM",
"WED_CLOS_TM": "12:00 PM",
"THU_OPEN_TM": "9:00 AM",
"THU_CLOS_TM": "4:00 PM",
"FRI_OPEN_TM": "9:00 AM",
"FRI_CLOS_TM": "4:00 PM",
"GlobalID": "11f6a13b-be96-4635-8a5c-3097c168d72d",
"CreationDate": 1501688531575,
"Creator": "abdalla.abdalla_SocialSecurity",
"EditDate": 1501688531575,
"Editor": "abdalla.abdalla_SocialSecurity",
"selected": null
}
},
{
"type": "Feature",
"id": 82,
"geometry": {
"type": "Point",
"coordinates": [
-96.7733829460792,
32.7732994077044
]
},

replace your lat and long values here &geometry=-96.915919%2C32.693022&geometryType=esriGeometryPoint&inSR=4326

*Note:Truncated the result for clarity here (full length of result is 997 lines)

Mapperz
  • 49,701
  • 9
  • 73
  • 132