Using Nearmap API WebTile as Basemap in ArcGIS API 3.x

193
1
05-03-2021 08:47 AM
RichardMoussopo
Occasional Contributor II

I am using the API version 3.36 and trying to use the WebTiledLayer as basemap. what I have tried so far:

1. Adding Nearmap WebTiledLayer directly works

var nearmapTiledLayer = new WebTiledLayer(
'https://api.nearmap.com/tiles/v3/Vert/{z}/{x}/{y}.jpg?apikey=MY_NEARMAP_API_KEY',
{
copyright: 'Nearmap',
id: 'nearmap',
}
);

map.addLayer(nearmapTiledLayer);

 

2. Setting WebTiledLayer as basemap: Fails

esriBasemaps.nearmap = {
baseMapLayers: [nearmapTiledLayer],
thumbnailUrl: '',
title: 'Nearmap',
};

this throws 400 error code

RichardMoussopo_0-1620056420471.png

 

3. I have also tried the following:

var nearmapTileLayer = new BasemapLayer({
type: 'WebTiledLayer',
url:
'https://api.nearmap.com/tiles/v3/Vert/{z}/{x}/{y}.jpg?apikey=MY_NEARMAP_API_KEY',
copyright: 'Nearmap',
id: 'nearmap'
});
var nearmapBasemap = new Basemap({
id: 'nearmap',
layers: [nearmapTileLayer],
title: 'Nearmap',
});

esriBasemaps.nearmap = {
baseMapLayers: [nearmapBasemap],
title: 'Nearmap',
};

And this throws the following error:

RichardMoussopo_1-1620056640190.png

Any suggestions?

 

 

Tags (1)
1 Reply
RichardMoussopo
Occasional Contributor II

var map;

require([
'esri/basemaps',
'esri/map',
'esri/layers/WebTiledLayer',
'esri/dijit/BasemapLayer',
'esri/dijit/Basemap',
'esri/layers/ArcGISTiledMapServiceLayer',
'dojo/dom',

'dojo/domReady!',
], function (
esriBasemaps,
Map,
WebTiledLayer,
BasemapLayer,
Basemap,
ArcGISTiledMapServiceLayer,
dom
) {

var nearmapTiledLayer = new WebTiledLayer(
'https://api.nearmap.com/tiles/v3/Vert/{z}/{x}/{y}.jpg?apikey=MY_NEARMAP_API_KEY',
{
copyright: 'Nearmap',
id: 'nearmap',
}
);

var nearmapBasemapLayer = new BasemapLayer({
type: 'WebTiledLayer',
url:
'https://api.nearmap.com/tiles/v3/Vert/{z}/{x}/{y}.jpg?apikey=MY_NEARMAP_API_KEY',
copyright: 'Nearmap',
id: 'nearmap',
//subDomains: ['0', '1', '2', '3'],
});
var nearmapBasemap = new Basemap({
id: 'nearmap',
layers: [nearmapBasemapLayer],
title: 'Nearmap',
});

esriBasemaps.nearmap = {
baseMapLayers: [nearmapBasemap],
thumbnailUrl: '',
title: 'Nearmap',
};

map = new Map('mapDiv', {
center: [-83.070543, 39.86905],
basemap: 'nearmap',
zoom: 14,
});

//map.addLayer(nearmapTiledLayer);
});

0 Kudos