1

Looked over the example can NOT figure out how to set basemap MANUALLY. I don't want a dijit widget, or any other libraries or anything like that. Just want to manually set a basemap to any of the already available types like Topographic, Satellites, Streets, etc. My script code so far is like this.

The part I can't figure out is marked with question marks.

    require([
        "esri/basemaps",
        "esri/map",
        "dojo/domReady!"
    ], function (esriBasemaps, Map) {



    /* ------------------------------------- */
    /* Basemap add one of the existing maps. */
    /* ------------------------------------- */
    esriBasemaps.myBasemap = {
        baseMapLayers ???
    };



    var map = new Map("map", {
        basemap: "myBasemap",
        center: [-118, 34.5],
        zoom: 8
    });



});
PolyGeo
  • 65,136
  • 29
  • 109
  • 338
Mike R.
  • 121
  • 4

2 Answers2

2

From the documentation javascript api:

basemap Optional Specify a basemap for the map. The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "dark-gray", "oceans", "national-geographic", "terrain" and "osm". Property added at v3.3. The "terrain" and "dark-gray" options added at v3.12.

You only need to put in the code the name of the basemap:
var map = new Map("map", {
    basemap: "streets|satellite|hybrid|etc..",
    center: [-118, 34.5],
    zoom: 8
});

PolyGeo
  • 65,136
  • 29
  • 109
  • 338
lele3p
  • 900
  • 1
  • 7
  • 14
  • Your questions was completely useless re-read what I said it is marked in bold! – Mike R. May 11 '15 at 22:36
  • To use the default maps is not necessary to use esriBasemaps. esriBasemaps is used when you want to add a "custom" basemap and call it with the name (see: https://developers.arcgis.com/javascript/jsapi/esri.basemaps-amd.html ).To set the basemap, simply invoke the method map.setBasemap with the name of the desired basemap. – lele3p May 12 '15 at 08:36
0

baseMapLayers parameter accepts array of wrapped urls like following:

esriBasemaps.myBasemap = {
  baseMapLayers: [
    {url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer"}
  ]
};

Official documentation: https://developers.arcgis.com/javascript/3/jsapi/esri.basemaps-amd.html Full source code sandbox: https://codepen.io/digz6666/pen/wPwPbW

digz6666
  • 201
  • 2
  • 7