Tilemill

Sebastian Bank edited this page Feb 16, 2015 · 12 revisions

This tutorial describes how to use data served by clld apps (like APiCS) with tilemill version 0.10.

As explained in the tilemill docs, data can be imported in the GeoJSON format from a public HTTP URL. clld apps provide exactly such URLs, e.g. to get the GeoJSON data of an APiCS feature simply append '.geojson' to the URL in your browser's location bar when looking at a feature: http://apics-online.info/parameters/3.geojson. Now tilemill doesn't recognize nested structures in the GeoJSON 'properties' fields, therefore clld apps provide another variant of GeoJSON data with flattened properties to use with tilemill. Again, this data is just one URL away: http://apics-online.info/parameters/3.flat.geojson.

To jumpstart a tilemill 0.10 project (i.e. to create a project directory as described here) based on the data of a parameter of a clld app, you can run a python script. This script will create a zip-file which can be unzipped into the project directory of your tilemill installation.

For example running

python tilemill.py http://apics-online.info/parameters/6

will create the file apics-online-info-6.zip

Examples

Combining data from WALS and WOLD

We may be interested in comparing lexical data from the the World Loanword Database with a WALS feature.

To do so, we can create three layers, two with data from WOLD using http://wold.clld.org/meaning/4-31.flat.geojson and http://wold.clld.org/meaning/4-33.flat.geojson as datasources, and one with data from WALS using http://wals.info/feature/129A.flat.geojson as datasource.

To compare the data, we can display the words for the meaning "the hand" and for the meaning "the arm" and colored dots for the values of the feature "Hand and Arm":

#wold-hand {
  text-wrap-width: 200;
  text-allow-overlap: true;
  text-face-name: "DejaVu Sans Bold";
  text-name: [values_0_name];
  text-vertical-alignment: top;
  text-dy: -2;
}

#wold-arm {
  text-wrap-width: 200;
  text-allow-overlap: true;
  text-face-name: "DejaVu Sans Bold";
  text-name: [values_0_name];
  text-vertical-alignment: bottom;
  text-dy: 2;
}

#wals-hand-and-arm {
  [values_0_domainelement_name="Different"] {
	marker-fill: green;
  }
  [values_0_domainelement_name="Identical"] {
marker-fill: red;
  }
}