danburzo / every-street Goto Github PK
View Code? Open in Web Editor NEWDrawing every street in Romania using OpenStreetMap data, Node.js and SVG
Home Page: http://danburzo.ro/every-street
License: MIT License
Drawing every street in Romania using OpenStreetMap data, Node.js and SVG
Home Page: http://danburzo.ro/every-street
License: MIT License
osmosis --read-pbf data/romania-latest.osm.pbf --tf accept-ways highway=* --used-node --write-pbf data/data.osm.pbf
This data was gathered using the latest florida image from geofabrik.de (md5sum 89a6468db0a90ce7b5392695892287bf) inside of a Ubuntu VM that was allocated 2GB of ram with 2 cores (i5-4570, host has 12GB of ram and was not under load)
Step | Time |
---|---|
Extracting Streets | 34s |
Extracting Nodes | 49s |
Loading Nodes | 1m 39s |
Applying Nodes | 5m 35s |
Finding Binding Box | 5s |
Mapping Coordinates | 24s |
Generating SVG | 19s |
Using node inspector to inspect the Applying Nodes step shows:
I'm not sure what the deal is with the idle time, but ignoring that we can see that Leveldown is taking 60% of the time reading from the database(Database and LevelDOWN._get are seperate at 30% each). I'm going to run some experiments with using Redis as an alternative to leveldb. Yes it will be in ram, but I'm hoping that because it is in a database the amount used should be much more manageable (LevelDB only uses 300MB of diskspace in this case)
Using docker could let you test a redis server really quick and cleanly (as it doesn't touch the host).
Right now you need to do it manually.
As described in this post, I followed your steps and used this PBF file to generate visualizations of every street in Brazil:
Just as a heads up to someone trying the same, I tweaked the final output image by hand (removing the long lines) because some streets were glitched:
Maybe some incoherent data in the original PBF?
Nevertheless the result is really interesting and I can share the generated SVG too if you'd appreciate. Thank you.
The command nodejs tools/load-nodes.js
returns this error:
/home/every-street-master/node_modules/level-writestream/index.js:5
db.createWriteStream = createWriteStream;
^
TypeError: Cannot set property 'createWriteStream' of undefined
at attachConstructor (/home/every-street-master/node_modules/level-writestream/index.js:5:24)
at /home/every-street-master/tools/load-nodes.js:15:2
at dispatchError (/home/every-street-master/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/util.js:64:35)
at /home/every-street-master/node_modules/level/node_modules/level-packager/node_modules/levelup/lib/levelup.js:119:14
at /home/every-street-master/node_modules/level/node_modules/leveldown/node_modules/abstract-leveldown/abstract-leveldown.js:39:16
If I console.log(db)
right here I get undefined
. So the whole levelup callback receives undefined for the database instance.
Any clues as to the cause of this?
Bounding box should be generated as part of extracting the nodes from the OSM data file.
How do you find the "natural" ratio when you use the Mercator projection? A mapWidth/mapHeight seems arbitrary.
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.