GithubHelp home page GithubHelp logo

isabella232 / osm-wayback Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mapbox/osm-wayback

0.0 0.0 0.0 21.75 MB

Scalable RocksDB index from OSM planet to lookup historic OSM objects.

License: BSD 3-Clause "New" or "Revised" License

CMake 12.67% C++ 79.43% Shell 1.42% Python 6.48%

osm-wayback's Introduction

osm-wayback Build Status

Stores a RocksDB with OSM ID <-> tag history and augments GeoJSON files with the history of tag changes.

๐Ÿš€ Final goal is to create historic geometries for each intermediate version of an OSM feature.

Build

Install mason to manage dependencies

git clone --depth 1 --branch v0.14.1 https://github.com/mapbox/mason.git .mason

Then build with cmake:

mkdir build
cd build
cmake ..
make

Run

First build up a historic tag index.

build_tag_lookup INDEX_DIR OSM_HISTORY_FILE

Pass a stream of GeoJSON features as produced by minjur (Note: minjur is no longer being developed, use osmium-export moving forward).

cat features.geojson | add_tags INDEX_DIR

The output is a stream of augmented GeoJSON features with an additional @history array of the following schema.

Historical Feature Schema for TAGS

OSM objects that have history will have an extra attribute prefixed with @. This @history object is an array of individual historical versions and is stored in the properties of the main GeoJSON Feature. The final object in the history array is the current version of the object. This allows tag changes to be easily tracked between all versions.

"@history": [ 
  <history object version 1>,
  <history object version 2>,
  ...
  <current version of object>
 ]

It should be noted that not all versions of an object may be included. Relying on solely the version number is not a guarantee. Previous versions may be missing for a variety of reasons including redaction, deletion of all tags, etc.

History Objects

Similar to the standard OSM-QA tile, each of these standard OSM object properties are kept.

@version
@changeset
@timestamp
@uid
@user

Additional Attributes

1. Tags

Tags are removed from the historical versions objects and only the diffs recorded. While this will require iterating over the tags in history to reconstruct them exactly per version, it has two worthy benefits: 1) Easily see when tags were added/changed/deleted and 2) limited duplication of data.

There are four possible outcomes when comparing two versions:

  1. Nothing is changed on the tags, the change was strictly geometrical. This is not possible with a WAY. A change to a way's geometry will not increment the version of the way.
  2. New Tags (new_tags): A user adds new tags to the object.
  3. Delete Tags (del_tags): Tags are removed from one version to the next.
  4. Modify Tags (mod_tags): The value of tag(s) are changed. Name expansion, for example: Elm St. --> Elm Street. In this case, we'll record both the previous value and the new value with this version so that the change can be easily referenced without looking at previous versions.
"@new_tags" : { 
  "key1" : "value1", 
  "key2" : "value2" 
},
"@del_tags": {
   "previous key 1" : "previous value 1",
   "previous key 2" : "previous value 2"
},
"@mod_tags": {
  "key1" : [
    "previous value",
    "new value"
  ],
  "key2" : [
    "previous value 2",
    "new value 2"
  ]
}

osm-wayback's People

Contributors

lukasmartinelli avatar jenningsanderson avatar

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.