Example code for Walkalytics API
We currently have example code for:
- ArcGIS Desktop
More examples are welcome. Fork this repo and send a pull request.
Setting up an API key file
Create a file
walkalytics-api-key in the respective client folder, e.g. in
ArcGIS-Desktop if you want to use the ArcGIS Toolbox tool. The API key file has the following format (see also the sample file):
machine api.walkalytics.com login <your dev.walkalytics.com account, i.e. your registered e-mail address> password <your primary key>
Use the file
walkalytics-api-key or put the key directly in the source code.
Running the code will print the service area, travel time for each POI and an
isochrone image as PNG (together with a world file). The coordinate system for
the PNG is
> python isochrone.py 828895 5932832 Source location is (828895,5932832). The service area for the source location is 3.45 square km. - POI 'Hello!' has a walking time of 0 minutes to the source point. - POI 'Is it me you're looking for?' has a walking time of 15 minutes to the source point. Save image isochrone_828895_5932832.png with an accompanying world file.
The ArcGIS Desktop integration is done by a Python toolbox. In the dialog
box, you need to specify a point layer and an output path for the raster
(currently only tested with a File Geodatabase). Additionally, input the
Walkalytics API key. If a file
walkalytics-api-key exists in the
ArcGIS-Desktop folder (netrc format, see above), the key is read from there.
Isochrone will read all points in the feature class, calculate the
walking isochrone for each point and save the resulting raster is in the output
Todo: Compare with Esri's routing based Drive Time Analysis and mode walking.
Run a local webserver in its directory with port 8000, for example with Python:
python -m SimpleHTTPServer 8000
or with node:
npm install http-server -g # install node module http-server -p 8000
If you want to run it on your webserver, contact mailto:firstname.lastname@example.org.
This example shows the walking isochrone on a webmap with Leaflet. Setting up and test works as with the OpenLayers example.