iandees / mongosm Goto Github PK
View Code? Open in Web Editor NEWAn OpenStreetMap importer/map-call for MongoDB
License: MIT License
An OpenStreetMap importer/map-call for MongoDB
License: MIT License
File "/medialibrary/Stuff/projects/custom_map/mongosm/map_server.py", line 49, in getNodesFromWays
for nodeId in way['nodes']:
KeyError: 'nodes'
Is map_server up-to-date?
I'm hitting the following error when I tried to import the osm-pbf file into MongoDB!
MacBook-Pro:mongosm jothi$ python insert_osm_data.py /Users/joe/Desktop/nordrhein-westfalen-latest.osm.pbf
Traceback (most recent call last):
File "insert_osm_data.py", line 11, in
from pymongo import Connection
ImportError: cannot import name Connection
I keep hitting this: ( and not sure if it's an issue at all )
sudo python insert_osm_data.py ../planet-latest.osm
348974k nodes, 0k ways, 0 relationsTraceback (most recent call last):
File "insert_osm_data.py", line 190, in
handler.parse(open(filename))
File "insert_osm_data.py", line 72, in parse
for (event, elem) in iterparse(file_obj, events=('start', 'end')):
File "", line 103, in next
IndexError: pop from empty stack
File "/medialibrary/Stuff/projects/custom_map/mongosm/map_server.py", line 224, in iter
nodeElem.setAttribute("lat", str(node['loc']['lat']))
TypeError: list indices must be integers, not str
insert_osm_data doesn't use lat
/lon
in loc
.
I have this error when trying to access api/0.6/map?bbox=...
:
OperationFailure: database error: can't find special index: 2d for:
should I use map_server or tile_server?
also should I use insert_osm_data or insert_tiled_osm_data?
Hi,
I had trouble getting some results through my queries so I modified the code a little.
At first I had some issues with the generated query which generated the following query:
Built query: {u'tags.highway': {'$exists': True}}
After I modified map_server.py:307 into this:
groups = re.findall(r'(?:\[(.*?)\])', xapiQuery.encode("utf-8"))
The map_server.py seems to generate now the correct strings without the prefix 'u'.
Also, in my generated Mongo DB the 'tags' in each element are called 'tg' and the wildcard query did not look very correct to me, so I modified map_server:326-329 into this:
elif right == u'*':
q['ky'] = { '$in': [left] }
else:
q['tg'] = [left, right]
I tested the new queries with the modified map_server.py and MongoHub.
Could someone confirm or deny my changes? Thanks in advance.
Best regards
PS I'm not a python programmer, so my changes might be not very stylish
Russian dump
way
"_id" : NumberLong(46151894),
"loc" : [
[
51.5588722,
46.0375795
],
[
51.558026,
46.0372197
],
[
51.5586159,
46.0391391
],
[
51.5577697,
46.0387793
]
],
"ch" : NumberLong(11623411),
"nd" : [
NumberLong(588413447),
NumberLong(588413451),
NumberLong(588413452),
NumberLong(588413448),
NumberLong(588413447)
],
"ts" : "2012-05-17T13:22:36Z",
"un" : "Eugene",
"ui" : NumberLong(26260),
"v" : 6,
"tg" : [
[
"addr:housenumber",
"14"
],
[
"addr:street",
"улица Аэропорт"
],
[
"building",
"yes"
],
[
"name",
"METRO"
],
[
"shop",
"supermarket"
]
],
"ky" : [
"addr:housenumber",
"addr:street",
"building",
"name",
"shop"
]
node
{ "_id" : NumberLong(588413451), "loc" : [ 51.5586159, 46.0391391 ], "ch" : NumberLong(11623411), "ts" : "2012-05-17T13:22:41Z", "un" : "Eugene", "ui" : NumberLong(26260), "v" : 4 }
is second in nd, but third in loc.
./insert_osm_data.py australia-oceania-latest.osm
./insert_osm_data.py: riga 7: errore di sintassi vicino al token non atteso "newline"
./insert_osm_data.py: riga 7: `<!DOCTYPE html>'
The import script reads in <changeset>
elements and attempts to read the default stuff (including timestamp).
We should probably just remove the changeset parsing because we're not doing anything with it right now.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.