Giter Club home page Giter Club logo

osm-activity's Introduction

osm-activity MIT license Build Status

โš ๏ธ This repository is no longer maintained by Lukas Martinelli.

A map visualization of OpenStreetMap activity and a Tile Reduce processor to count the changes within a tile over the months of the last decade.

๐ŸŒ Check the WebGL map to see OSM activity for your region

Demo of interactive web map

Demo of statistics

Download

You can download the resulting GeoJSON file from the latest GitHub release. Please ping me if you require other data formats.

Run yourself

First install the required dependencies. You need to new Node version (> 5).

npm install

Now download the Mapbox QA Tiles.

curl -o planet.mbtiles.gz https://s3.amazonaws.com/mapbox/osm-qa-tiles/latest.planet.mbtiles.gz
gunzip planet.mbtiles.gz

Invoke the index.js file with the planet file and output GeoJSON file.

node index.js -m planet.mbtiles -o changes.geojson

Generate Vector Tiles

To create the heatmap visualization we create a point layer with the tiles for zoom level 1 to 4 and a polygon layer with the tiles for zoom level 5 (overzooming will ensure this also works for higher zoom levels).

First create the point GeoJSON file and strip away all attributes to minimize file size.

node index.js -m planet.mbtiles -o tile_updates_point.geojson --strip-history --point

Now we create the point MBTiles (and drop points at lower zoom levels).

tippecanoe tile_updates_point.geojson -o tile_updates_point.mbtiles \
    --minimum-zoom=1 --maximum-zoom=4 --base-zoom=4 --include=total

And now we create the polygon GeoJSON file (containing the tile geometries).

node index.js -m planet.mbtiles -o tile_updates_bbox.geojson --strip-history

And create the polygon MBTiles (do not drop any features and only a single zoom level)

tippecanoe tile_updates_bbox.geojson -o tile_updates_bbox.mbtiles \
    --minimum-zoom=5 --maximum-zoom=5 --base-zoom=5

We have two vector tile sets now for the low and high zoom levels we can style in Mapbox Studio.

Generate History JSON Tiles

To make the history of the tiles accessible via web we group them by their ancestor tile (zoom level 5). This makes it possible to request the history of a tile by querying it's ancestor.

You need to provide a non existing directory where the JSON history of the tiles is stored. The directory will be structured into a folder structure z/x/y.json.

node index.js -m planet.mbtiles -o changes.geojson -j tiles

The tile history is hosted via GitHub pages.

http://osm-activity.lukasmartinelli.ch/tiles/history/{z}/{x}/{y}.json

Use Statistics

The script can track statistics and output them into a file with -s stats.json. This records different percentile values and makes it useful to style with different data classes.

node index.js -m planet.mbtiles -o changes.geojson -s stats.json

Similar Projects

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.