Geoportal SDK 2D/3D API Reference

Module: Utils/MapLoader

Gp.Map.load()

Geoportal map loader.

Provide convenience method to create a Map and attach it to a HTML element.

Methods

staticload(div, mapOptions){Gp.Map}

Utils/MapLoader.js, line 12

Initialize a Geoportal map in an HTML element.

Name Type Description
div String | DOMElement

The HTML element or its id where the map will be loaded.

mapOptions Gp.MapOptions optional

Options for loading the map.

Returns:
Geoportal map.
Example
var map = Gp.Map.load(
         'viewer-map',
         {
             apiKey: "YOUR_API_KEY",
             reloadConfig: true,
             isWebGL2: false,
             enginePath3d: "path/to/itowns.js",
             viewMode: "3d",
             center: {
                 location: "rue pasteur, Saint-Mandé"
             },
             zoom: 16,
             tilt: 0,
             azimuth: 45,
             controlsOptions: {
                 mousePosition: {},
                 search: { maximised : true }
             },
             mapEventsOptions: {
                   "mapLoaded": window.initMap,
                   "layerChanged": window.callbackLayerChanged,
                   "zoomChanged": window.callbackZoomChanged,
                   "centerChanged": window.callbackCenterChanged,
                   "azimuthChanged": window.callbackAzimuthChanged,
                   "tiltChanged": window.callbackTiltChanged
             },
             layersOptions: {
                 'GEOGRAPHICALGRIDSYSTEMS.MAPS.SCAN-EXPRESS.STANDARD': {}
             }
         }
   );

   // abonnement à l'evenement "mapLoaded"
   map.listen("mapLoaded", function (e) { console.log("objet map", e); });