Skip to content
This repository has been archived by the owner on Apr 13, 2019. It is now read-only.

Configuration

Alex Morega edited this page Mar 5, 2014 · 6 revisions

GistMap renders a map based on a JSON configuration file. Here is an example:

{
  "layers": [
    {
      "type": "background",
      "source": "osm"
    },
    {
      "type": "choropleth",
      "features": "https://dl.dropboxusercontent.com/s/qsg4n1kg8bkqfhi/judete.topojson",
      "data": "https://docs.google.com/spreadsheet/ccc?key=0AlBmcLkxpBOXdEEzSE1HWTdWeGYxTG9ja0l4c2VyRHc&usp=drive_web#gid=0"
    }
  ]
}

Layers

The map is made up of layers. You typically want a background layer, then a choropleth or bubble layer with your data. These are the available layer types:

tiles

An XYZ tile layer, as provided by OpenStreetMap, CloudMade, MapBox and many others.

{
  "type": "tiles",
  "src": "http://{s}.tile.osm.org/{z}/{x}/{y}.png",
  "attribution": "&copy; <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors"
}

background

Preconfigured background layers. Only OpenStreetMap is currently available.

{
  "type": "background",
  "source": "osm"
}

choropleth

Polygons colored according to value.

{
  "type": "choropleth",
  "features": "https://dl.dropboxusercontent.com/s/qsg4n1kg8bkqfhi/judete.topojson",
  "data": "https://docs.google.com/spreadsheet/ccc?key=0AlBmcLkxpBOXdEEzSE1HWTdWeGYxTG9ja0l4c2VyRHc&usp=drive_web#gid=0"
}

features is a Features file. data is a Data file.

By default, a choropleth layer maps the values to a blue color scale, but this can be overridden by specifying colorRange:

"colorRange": {"min": {"color": "#aaa", "value": 0}, "max": {"color": "#038", "value": 50}}

bubble

Circles scaled according to value.

{
  "type": "bubble",
  "features": "https://dl.dropboxusercontent.com/s/3718h4vi5bk5alm/localitati.geojson",
  "data": "https://docs.google.com/spreadsheet/ccc?key=0AlBmcLkxpBOXdEZHd05HOGRzU3d6OHk4MG00RV9ySVE&usp=drive_web#gid=0"
}

features is a Features file. data is a Data file. Circles are scaled according to the maximum value of the data, which is drawn as a 5000 km² circle, the size of a medium city.

Clone this wiki locally