mapbox / tile-reduce

mapreduce vector tile processing
ISC License
184 stars 33 forks source link

example code doesnt match format of latest-planet.mbtiles #66

Closed uberguru closed 8 years ago

uberguru commented 8 years ago

I downloaded the lastest planet mbtiles from https://s3.amazonaws.com/mapbox/osm-qa-tiles/latest.planet.mbtiles.gz

The count example works with the included data set, but not with the 22gb planet mbtiles.

The example code uses key value to count i.e. count buldings.

{
  "vector_layers": [
    {
      "id": "buildings",
      "description": "",
      "minzoom": 15,
      "maxzoom": 15,
      "fields": {
        "id": "Number",
        "osm_id": "Number",
        "type": "String",
        "name": "String"
      }
    },
    {
      "id": "roads",
      "description": "",
      "minzoom": 15,
      "maxzoom": 15,
      "fields": {
        "id": "Number",
        "osm_id": "Number",
        "type": "String",
        "name": "String",
        "tunnel": "Number",
        "bridge": "Number",
        "oneway": "Number",
        "z_order": "Number",
        "class": "String",
        "access": "String",
        "service": "String",
        "ref": "String"
      }
    }
  ]
}

however the planet mbtiles the key seems to always be osm, but the fields contain the tags, im just not able to figure out how to convert the examples to work with the full dataset due to the data structure being different, i.e. building is a field not a key.


{
  "vector_layers": [
    {
      "id": "osm",
      "description": "",
      "minzoom": 12,
      "maxzoom": 12,
      "fields": {
        "_osm_way_id": "Number",
        "_version": "Number",
        "_changeset": "Number",
        "_uid": "Number",
        "_user": "String",
        "_timestamp": "Number",
        "hires": "String",
        "hires:checkdate": "String",
        "hires:imagery": "String",
        "source": "String",
        "boat": "String",
        "highway": "String",
        "name": "String",
        "note": "String",
        "name:en": "String",
        "waterway": "String",
        "natural": "String",
        "width": "String",
        "boundary": "String",
        "maritime": "String",
        "admin_level": "String",
        "border_type": "String",
        "water": "String",
        "source:name": "String",
        "power": "String",
        "building": "String",

Appreciate any guidance i'm by no means a developer but really interested in using this code for some data analysis.

mourner commented 8 years ago

Example fixtures do not necessarily have to match the layout of the OSM planet, they're just an example source. The OSM QA Tiles have just one osm layer, so you would access it with layers.osm.osm.

For real world processor examples, see https://github.com/mapbox/osm-sidewalker, https://github.com/mapbox/road-diff, https://github.com/mapbox/osm-coverage. We'll add them as a list to the readme.