Git Product home page Git Product logo

osmo's Introduction

osmo: Populate a MongoDB collection with OpenStreetMap data


Features

- osmo populates a MongoDB database collection with all nodes, ways and relations
- Currently, only OSM XML (.osm) is supported
- It's just slightly slower than Osmosis (with Postgres)
- Prerequisites: see DEPENDENCY
- Building:

	make

	(A priority is it to make this work in both Mac OS and Linux!)

- Synopsis:

	bin/osmo DATAFILE DATABASE.COLLECTION

- To add an index on the primary key:

	mongo DATABASE --eval \
"printjson(db.COLLECTION.ensureIndex({ p: 1, id: 1 }, { unique: true, dropDups: true, background: true }))"


Data model

The data model supported by osmo is focussed on minimal data size and unification. Some principles:

- nodes, ways and relations are transformed to GeoObject instances to unify the concept and to simplify queries on only 1 collection
- Every geoObject has a key named "p" (prefix). It can have the values, "n" (node), "w" (way) or "r" (relation).
- keys for regular fields (user, timestamp, ...) are abbreviated to save space
- The geoObject primary key is [ 'p', 'id' ]
- Example for a GeoObject instance:

	{
		"_id" : ObjectId("4e3213dbe9b522a655e3f5ff"),
		"c" : 4977984,
		"id" : 318214,
		"p" : "r",
		"parts" : { 
			"list" : [
				{
					"p" : "n",
					"id" : 319621296
				},
				{
					"p" : "n",
					"id" : 560090559
				},
				{
					"p" : "n",
					"id" : 292635574
				},
				{
					"p" : "n",
					"id" : 292635576
				},
				{
					"p" : "n",
					"id" : 245431191
				},
				{
					"p" : "w",
					"id" : 48289915
				},
				{
					"p" : "w",
					"id" : 49366289
				},
				...
			],
			"info" : [
				{
					"role" : "forward"
				},
				{
					"role" : "forward"
				},
				{
					"role" : ""
				},
				{
					"role" : "forward"
				},
				{
					"role" : ""
				},
				{
					"role" : "forward"
				},
				{
					"role" : "forward"
				},
				...
			]
		}, 
		"t" : 1276427410,
		"tags" : { 
			"network" : "VRT",
			"operator" : "SWT",
			"ref" : "4",
			"route" : "bus",
			"type" : "route"
		}, 
		"u" : { 
			"id" : 109925,
			"name" : "WanMil"
		}, 
		"v" : 6
	}

- "parts" is an ObjectView object that has always two properties: "list" (a list of GeoObject references) and "info" (that optionally holds information about the referenced objects in the same order). GeoObjects with p=n do not have parts, with p=w, parts are always references to nodes, with p=r parts can reference any type (node, way, relation).


Contribute

Take a look at TODO to see a list of priorized features that are still lacking.

osmo's People

Contributors

akidee avatar

Watchers

James Cloos avatar Location Star 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.