8.1 Census Map: Setting up ArcGIS Server

In this tutorial, we will be building an interactive “census” maproom. Users will be able to click anywhere on the map to get census data for that location.

ArcGIS Server

First, create a new map service in ArcGIS Server that contains some census data:

  1. Create an ArcMap project with a census tract layer that has census data in the attribute table
  2. Publish the project as a new map service on ArcGIS Server

Here is an example map service.

p.s. If you need instructions for downloading American Factfinder 2 data, click here. More instructions about working with census data are available here.

Querying an ArcGIS Server Layer

Once you have a map service on ArcGIS Server, you can query the layers that the service contains.  For the example map service, there is one layer “us_tracts” which you can access here:

http://whippet.ats.ucla.edu/ArcGIS/rest/services/up206b/week9/MapServer/0

You can then click on the “query” link at the bottom of the page to go to the ArcGIS query wizard page:

http://whippet.ats.ucla.edu/ArcGIS/rest/services/up206b/week9/MapServer/0/query

In the query page, fill the wizard form with the following to access data for a specific location:

  1. Enter a known lat/lon pair in this format (lon,lat) in the filter geometry box.
    Ex: -118,34
  2. Select “point” for geometry type
  3. Enter “*” for return fields
  4. select “json” for format
  5. click the Query(GET) button
ArcGIS query page

ArcGIS query page

Notice how this returns a JSON feed for the census tract polygon the point falls in (it’s a point-in-polygon spatial query).  Also, notice the URL that is generated from this call.  If you take away all the irrelevant url parameters, this is the trimmed url string:

 

http://whippet.ats.ucla.edu/ArcGIS/rest/services/up206b/week9/MapServer/0/query?text=&geometry=-118,34&geometryType=esriGeometryPoint&spatialRel=esriSpatialRelIntersects&returnGeometry=true&outFields=*&f=pjson

What this means is that you can perform a spatial query to this published map service, and instantly retrieve data for any given point within the layer’s bounds! Since this is a census tract layer that encompasses the entire USA, any latitude/longitude point within the entire country will produce a successful return of data.  Now let’s apply this logic by making this spatial query call to ArcGIS Server dynamically from a Google Map using jQuery.

Leave a Reply