Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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?

Thanks.

share|improve this question
1  
have you created tiles from your own basemap? –  Mapperz Mar 15 '13 at 1:40

2 Answers 2

up vote 6 down vote accepted

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);
share|improve this answer

You don't have to specify a built-in basemap. Add your custom basemap as a layer like so.

var map;
require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/domReady!"],
function (Map, ArcGISTiledMapServiceLayer ) {
    map = new Map("map", {                
        center: [-76.756, 40.241],
        zoom: 8
    });            
    var customBasemap = new ArcGISTiledMapServiceLayer(
    "http://services.arcgisonline.com/ArcGIS/rest/services/NatGeo_World_Map/MapServer");
    map.addLayer(nationalGeographicBasemap);
});
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.