Skip to content

wallabyway/geo-three-ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

geo-three-ext

Add maps to your Forge Viewer 3D scene, like mapbox, bing maps, google maps, etc. This uses geo-three library, but is hard coded for 'Planar' and 'RaycastingLOD' options, to minimize the library size.

geothree-ext

GETTING STARTED

Add the "GeoThreeExtension" extension to viewer, like this:

viewer = new Autodesk.Viewing.Private.GuiViewer3D(div, { extensions: ["GeoThreeExtension"] });

and make sure to add the library, like this:

<script type="text/javascript" src="./geo-three.ext.js"></script>

CONFIGURATION

Set the center location of your model, by adjusting the map's position and tile starting point, like this:

map.position.set(14900,-27300,-45);

class MapPlaneNode extends MapNode {
	    constructor(parentNode = null, mapView = null, location = MapNode.ROOT, level = 7, x = 20, y = 49)
      

Note: To get Earth scale, you must set the level=0, and set..

UnitsUtils.EARTH_RADIUS = 6378137;

// move the camera into position:
var coords = Geo.UnitsUtils.datumsToSpherical(LAT, LONG);
cam.target.set(coords.x, 0, -coords.y);
cam.position.set(0, 1000, 0);

This will move the Forge-Viewer camera to the (LAT, LONG) position on Earth.

Note: You will also need to re-position the Forge Viewer's global-offset

Also, the camera navigation is not good at navigating a map. Consider adding THREE.MAPControl

RELATED WORK