AnsweredAssumed Answered

esri/basemap baseLayers collection

Question asked by MikeTownshend on Feb 15, 2017
Latest reply on Feb 15, 2017 by MikeTownshend

I am in the process of building a custom web app that I have working properly using the JSAPI v 3.19. This is my first experience with the 4.2 version.  I can not find examples of how to properly build a new Basemap in the 4.2 docs.

When I replace the reference to customBaseMap in the Map object with "hybrid" it works fine as it is using a basemap from AGOL.  When I reference customeBaseMap in the Map object I get a blank map.  When I use FireBug or the IE Developer tools I get no error.  Attached is the full code.  Below is a snip of the JS:

 

<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/Basemap",
"dojo/domReady!"
],
function(
Map, MapView,Basemap
) {

var imageURL = "http://firstmap.gis.delaware.gov/arcgis/rest/services/DE_Imagery/DE_Imagery_2012/ImageServer";
var labelURL = "http://firstmap.gis.delaware.gov/arcgis/rest/services/BaseMap/DE_AerialCache/MapServer";

var customBasemap = new Basemap({
baseLayers: [
{ url: imageURL },
{ url: labelURL }
],
title: "Satellite",
id: "myMap"
});

var map = new Map({
basemap: customBasemap
});

var view = new MapView({
container: "viewDiv",
map: map,
extent: { 
xmin: -8444782,
ymin: 4634522,
xmax: -8360273,
ymax: 4853595,
spatialReference: 102100
}
});

 

});
</script>

 

Has anyone run into this before or know if some solid documentation on how to build a collection of custom basemaps?

Attachments

Outcomes