Are there any JS library out there that would render normal, flat maps (like Leaflet) into a perspective map like this one, on the web:
Also, anyone seen anything that could turn CartoDB data into 3D representation, like this?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityAre there any JS library out there that would render normal, flat maps (like Leaflet) into a perspective map like this one, on the web:
Also, anyone seen anything that could turn CartoDB data into 3D representation, like this?
Maybe you could use Osmbuildings. Its a JavaScript library for visualizing OpenStreetMaps (or custom GeoJSON) building geometry into a 3D perspective.
It use OpenStreetMaps data directly. Just add the loadData() method:
var map = new L.Map('map').setView([52.50440, 13.33522], 17);
var osmb = new OSMBuildings(map).loadData();
L.control.layers({}, { Buildings:osmb }).addTo(map); // add to layer switcher (optional)
Or, you could load your own GeoJSON. Just change the loadData() method to the setData(geojson):
var osmb = new OSMBuildings(map).setData(geoJSON);
Your data need to have a height property, and you can change the wall and roof color dynamically:
osmb.setStyle({
wallColor:'rgba(100, 100, 250, 0.701961)',
roofColor:'rgb(220, 220, 50)',
shadows:true
});
And even change the shadow perspective by setting daytime:
osmb.setDate(new Date(2014, 3, 24, 13, 0));
setData
method, but set
works! It tjus becomes: var osmb = new OSMBuildings(map).setData(geoJSON);
May 21, 2019 at 11:00
This is one of the primary use-cases for ViziCities (3D cities in the browser powered by OpenStreetMap), although the data layers aren't currently working yet. Perhaps something to consider for the future: https://github.com/robhawkes/vizicities
Disclaimer: I'm the developer of ViziCities
You can use OSM2world to pass 2D data from OpenStreetMap (map.osm) to 3D objects (map.obj), then use another converter (convert_obj_three.py) to convert it into a threejs JSON model (map.js), and then use it in a threejs scene.
You can see how here:
The closest I've seen is the work of Mike Bostock.
He has a really cool map which has a kind of oblique projection.
But there's nothing that makes it easy. D3 does my head in with respect to setting up projections. You can make amazing things if you work at it though.
http://osm2world.org/ works without WebGL, but uses Java instead of js.
Designed for output of Openstreetmap buildings data, it should be adoptable for other 3D data as well.
The output is a slippy map similar to leaflet: http://maps.osm2world.org/
Well, with CartoDB you can do something like this http://andrewxhill.com/cartodb-examples/scroll-story/pluto/index.html#4
You have to use this CartoCSS parameter: { building-height: 512; }
More info here: https://github.com/CartoDB/cartodb-pluto