kekscom / osmbuildings

OSM Buildings Classic 2.5D
http://osmbuildings.org
BSD 2-Clause "Simplified" License
505 stars 140 forks source link

Importing GeoJSON data to babylon JS | Rendering 3D city #104

Closed treant-prime closed 4 years ago

treant-prime commented 7 years ago

I'm trying to render a city in Babylon JS. Babylon uses WebGL engine too.

Values returned by GeoJSON are not readable by Babylon JS. Is there any way i can use coordinates form OSMBuildings to represent them as Babylon JS objects?

kekscom commented 7 years ago

You would need to triangulate objects from GeoJSON. This is done for example in WebGL version of OSM Buildings. See https://github.com/OSMBuildings/OSMBuildings/tree/master/src/triangulate If too complicated for your needs, an OSM source providing OBJ files might be better fit.

treant-prime commented 7 years ago

I've learned how to calculate proper coordinates from long and lat. I've also managed to download proper Mapbox tile from these coordinates (example http://a.tiles.mapbox.com/v3/osmbuildings.kbpalbpk/16/36308/21713.png). But I still have CORS Policy warning. I can't download any JSON to work with. What can I do to avoid CORS policy warning? screen shot 2016-11-28 at 15 12 04

kekscom commented 7 years ago

Simply: put it on a web server :-) Can be a any localhost.

treant-prime commented 7 years ago

Hi, I'm still working on rendering 3D city based on GeoJSON data. Here is what I've managed to render form MAPZEN geoJSON: screen shot 2016-12-02 at 08 57 01

I would like to do the same thing with OSMB since your JSONs are similar in structure.

Unfortunately I still have problem with CORS policy (even after putting project on server). I'm using your codepen example http://codepen.io/osmbuildings/pen/avXGJy. http://a.data.osmbuildings.org/0.2/uejws863/tile/16/35210/21492.jsonShould I use other url, with proper key?

screen shot 2016-12-02 at 11 26 04

kekscom commented 7 years ago

Use key anonymous instead.

Bonguii commented 5 years ago

@treant-prime I would like to ask you how to import the geojson data to babylon and use it as a ground?