Trying to add html basemap

1256
1
09-23-2016 02:34 PM
CadAssistant_3
New Contributor II

Hello, I am trying to add a URL (aerial image) as a basemap to my html code but I can not seem to figure it out.

I currently have it set up like this:

function init() {
map = new esri.Map("map", {
basemap: "streets",
center: [-117.885170, 33.883592],
zoom: 16
});

If someone could help me out that would be great. Thanks.

0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Here is the help doc for basemaps class that has a code snippet for use a custom basemap:

esri/basemaps | API Reference | ArcGIS API for JavaScript 3.18 

require([
    "esri/basemaps",
    "esri/map",
    "dojo/domReady!"
  ], function (esriBasemaps, Map){
    esriBasemaps.delorme = {
      baseMapLayers: [{url: "https://services.arcgisonline.com/ArcGIS/rest/services/Specialty/DeLorme_World_Base_Map/MapServer"}
      ],
      thumbnailUrl: "https://www.example.com/images/thumbnail_2014-11-25_61051.png",
      title: "Delorme"
    };

    var map = new Map("ui-map", {
      basemap: "delorme",
      center: [-111.879655861, 40.571338776], // long, lat
      zoom: 13,
      sliderStyle: "small"
    });
});