Sunday, 22 December 2019

Using own basemap with ArcGIS API for Javascript?


I'm trying to make a map using the Javascript API.


I want to use my own basemap, but I can't find the most simple code to do this.


I always see something like this:



  function init() {
map = new esri.Map("mapDiv", {
basemap: "satellite",
center: [-97.395, 37.537],
zoom: 11
});

But I don't want to use the ArcGIS online basemaps.


What is the code to make a map service I am hosting my basemap?



Answer




The API Reference for the Map Class says the following:



The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". As of version 3.3



You should instead, just define a new ArcGIS Tiled Map Service Layer and use it as follows:


var baseMapLayer = new esri.layers.ArcGISTiledMapServiceLayer("your URL");
map.addLayer(baseMapLayer);

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...