Tutorial 8 — Querying Places Location API

What is an API

An API (Application Programming Interface) is simply some software that sends information back and forth between a website or app and a user.

When a company offers an API to their customers, it just means that they’ve built a set of dedicated URLs that return pure data responses

Read more here: What is an API? In English, please.

Location APIs

The ArcGIS Server REST API provides a simple, open Web interface to services hosted by ArcGIS Server. The API allows web developers to access ArcGIS server data through a series of URL requests.

Performing an API Request

ESRI Geocoding Service API

The geocoding service can find addresses, businesses, and places around the world. Address text can be converted to location candidates and a location can be converted into an address. The service provides suggested address candidates for partial address and place name text.

Specifically, we will be using the findAddressCandidates method. The result of this operation is a list of candidates with information including address, location, and score.

Example “findAddressCandidates” request:

https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?

Breaking it down:

Read more here to customize API request:

Full API Request:

https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/findAddressCandidates?singleLine=
&location=-73.958540,40.716305
&category=Pet Store
&outFields=PlaceName,Place_Addr,Type,Distance
&f=pjson
  • To perform an API call, customize the example request and paste the full request into the browser address bar and hit Enter

Interpreting Results

Google Places API

The Places API is a service that returns information about places using HTTP requests. Places are defined within this API as establishments, geographic locations, or prominent points of interest.

The Places API lets you search for place information using a variety of categories, including establishments, prominent points of interest, and geographic locations. You can search for places either by proximity or a text string. A Place Search returns a list of places along with summary information about each place.

Example “NearbySearch” request:

https://maps.googleapis.com/maps/api/place/nearbysearch/output?

Breaking it down:

Read more here to customize API request:

Full API Request:

https://maps.googleapis.com/maps/api/place/nearbysearch/json?
location=40.753479,-73.982972
&radius=500
&type=restaurant
&key=YOUR_API_KEY
  • To perform an API call, customize the example request and paste the full request into the browser address bar and hit Enter

Interpreting Results

Exporting Results and Importing to QGIS

Convert JSON to CSV

  • This request results are formatted as a JSON file.
  • To save this file, right-click on the web page, select “save as” and name the results as a .json file (ex. results.json) and specify file type as “All Files (*.*)”
  • Navigate to this website to convert your results.json into a .csv file.

Import CSV as Points in QGIS

--

--

Richard Chou
Data Mining the City — City Playlab

I am passionate about developing data-driven design strategies for urban design and city building of the next century.