Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

ArcGIS MapServer

Adrian Edwards edited this page Jun 6, 2021 · 3 revisions

Adding a runner for an ArcGIS MapServer

Set up your code

  1. Make a new directory for your new state. Unless otherwise specified, the directory should be named runners/<state>/arcgis_map (e.g., runners/wi/arcgis_map).

Find the data

  1. Open developer console in your web browser, then open the Network panel

  2. Open the ArcGIS dashboard for your state. Here is Wisconsin's dashboard, as an example.

  3. In the Network developer panel, filter for urls with the string "query" (or "MapServer") in them. If you cant find any "MapServer" URLs and only see "FeatureServer" URLs, then you likely want to visit the FeatureServer page

  4. For each tab in the dashboard, you should see urls that looks like:

    https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_Vaccine_Provider_Sites/MapServer/0/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=*&returnGeometry=true&returnTrueCurves=false&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&resultOffset=&resultRecordCount=&queryByDistance=&returnExtentsOnly=false&datumTransformation=&parameterValues=&rangeValues=&f=geojson

  5. Remove all query args and the "query" part from the urls found above. This will be useful when writing the fetch script. It should look like:

    https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_Vaccine_Provider_Sites/MapServer/0

Configure fetch.py

There is not (yet) a shared configureable fetcher for these urls so there is not a convenient .yml solution like there is for FeatureServer URL's. There is, however a python script that can be easily used.

Example

See #110 for a sample PR.

Instructions

  1. In the directory you created (runners/<state>/arcgis_map), create a file called fetch.py

  2. Paste the following template into your fetch.py and update the values for the url and output filename (where wi_arcgis_map.json is in this example)

    #!/usr/bin/env python3
    
    import sys
    
    from arcgis.features import FeatureLayer
    
    url = "https://dhsgis.wi.gov/server/rest/services/DHS_COVID19/COVID19_Vaccine_Provider_Sites/MapServer/0"
    
    output_dir = sys.argv[1]
    if output_dir is None:
        print("Must pass an output_dir as first argument")
    
    layer = FeatureLayer(url)
    results = layer.query(return_all_records=True)
    results.save(output_dir, "wi_arcgis_map.json")
  3. Test your fetcher by running:

    poetry run vaccine-feed-ingest fetch <state>/arcgis_map

    In our case, this command will look like:

    poetry run vaccine-feed-ingest fetch wi/arcgis_map

  4. That's it! Since MapServer's dont appear to have a serviceItemId like FeatureServer's, the arcgis python module (ingestors/arcgis.py) likely wont be able to be resused for these MapServer URL's download the locations from each layer.

Configure parse.yml

TBD - The FeatureServer page may provide useful information for similar GIS data

Normalize

At this time there is no shared tooling for normalization. The FeatureServer page may provide useful information for similar GIS data