This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

How to import OSM Data into mongoDB in easy way

0

hey can any one tell me how to import OSM data in mongoDB step by step.

This is the link of data http://download.geofabrik.de/europe/germany/baden-wuerttemberg/karlsruhe-regbez.html

asked 04 Aug '14, 22:25

vickyvikas's gravatar image

vickyvikas
43111
accept rate: 0%


3 Answers:

1

MongoDB is not the database of choice for typical OSM operations so you are unlikely to find any tried and tested howtos beyond what any major search engine will give you if you type in "openstreetmap mongodb", namely http://derickrethans.nl/importing-osm-into-mongodb.html

answered 04 Aug '14, 22:58

Frederik%20Ramm's gravatar image

Frederik Ramm ♦
82.5k927201273
accept rate: 23%

1

It mostly depends on what you want to do with the data. You can always parse the data yourself and import it that way. How you store data depends greatly on what you want to do with it.

For rendering maps (a common OSM usage), you need geographic indexes, for doing spatial analysis, you need geographic functions (what's the distance between X and this road), if these things are not in MongoDB, then you will not be able to easily use OSM data in MongoDB.

answered 08 Jun '15, 13:27

rorym's gravatar image

rorym
5.4k1449100
accept rate: 11%

Fortunately, MongoDB does support geospatial indexes and queries. https://docs.mongodb.com/manual/geospatial-queries/

(11 Sep '18, 21:53) cheater512

1

This can be done using the mongosm importer.

  1. Download the osm file: http://download.geofabrik.de/europe/germany/baden-wuerttemberg/karlsruhe-regbez-latest.osm.bz2.
  2. Extract the file. Try f.ex. 7zip, or bunzip2 karlsruhe-regbez-latest.osm.bz2 in a shell.
  3. Download the repo. Either from me (patched), or from the original and replace Connection with MongoClient.
  4. python mongosm-master/insert_osm_data.py karlsruhe-regbez-latest.osm imports the data.

cross-post to https://gis.stackexchange.com/a/240341/97214, as the question was cross-posted as well

answered 14 May '17, 19:19

serv-inc's gravatar image

serv-inc
261
accept rate: 0%

Source code available on GitHub .