Search code examples
three.jsar.js

Openstreetmap data in AR.js + Three.js


In location-based AR.js+Three.js how would I go about creating markers - for example building outlines or street paths - based on OSM data?

The examples I found seem to use measurements in some sort of three.js space, whereas OSM data provides lat-lon coordinates.

Is there some functionality to convert coordinates into three.js units of measure, or do I have to do that from scratch?


Solution

  • I found the solution by poking around in the source:

    console.log((new THREEx.LocationBased).lonLatToWorldCoords(12.326937241282431, 45.43795891900473));
    

    and then found it in the docs here