map = new Map("map", { basemap: "streets", center: [-111.5, 39.541], zoom: 7 });
function initToolbar(evtObj) { app.tb = new Draw(evtObj.map); app.tb.on("draw-end", doBuffer); }
Rene:
I'm not familiar with adding a basemap. Is that short-hand syntax that can be used only for ESRI's basemaps?
If I have my own mapservice(s), how would I add them as a basemap like this example did for ESRI's basemap?
"dijit/layout/ContentPane"], function(dom, domAttr, array, Color, parser, esriConfig, Map, Graphic, GeometryService, BufferParameters, Draw, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol){ var map, gsvc, tb; parser.parse(); map = new Map("map", { basemap: "streets", center: [-75.72, 39.96], zoom: 10 }); map.on("load", initToolbar);
"dijit/layout/ContentPane"], function(dom, domAttr, array, Color, parser, esriConfig, Map, Graphic, GeometryService, BufferParameters, Draw, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol){ var map, gsvc, tb; var basemap = new esri.layers.ArcGISTiledMapServiceLayer("https://myServerLink/MapServer", { useMapImage: true, "id": "Basemap" }); map.addLayer(basemap); parser.parse(); map = new Map("map", { basemap: "basemap", center: [-75.72, 39.96], zoom: 10 }); map.on("load", initToolbar);
Specify a basemap for the map. The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". As of version 3.3
map.addLayer(basemap);
Below is the original code from the sample"dijit/layout/ContentPane"], function(dom, domAttr, array, Color, parser, esriConfig, Map, Graphic, GeometryService, BufferParameters, Draw, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol){ var map, gsvc, tb; parser.parse(); map = new Map("map", { basemap: "streets", center: [-75.72, 39.96], zoom: 10 }); map.on("load", initToolbar);
I added a line of code to declare the var basemap and another line of code to add the basemap. I then changed the basemap variable from streets to my new basemap variable"dijit/layout/ContentPane"], function(dom, domAttr, array, Color, parser, esriConfig, Map, Graphic, GeometryService, BufferParameters, Draw, SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol){ var map, gsvc, tb; var basemap = new esri.layers.ArcGISTiledMapServiceLayer("https://myServerLink/MapServer", { useMapImage: true, "id": "Basemap" }); map.addLayer(basemap); parser.parse(); map = new Map("map", { basemap: "basemap", center: [-75.72, 39.96], zoom: 10 }); map.on("load", initToolbar);
But now no map shows up. Can anyone tell me what I am doing wrong in the modification of this sample?
I also changed the opening extents of the map so it would be centered on my basemap service.