Je veux ajouter la couche carte Google pour le contrôle Esri BaseMapGallery. Tout allait bien jusqu'à ce que je mette à jour l'application web pour utiliser la dernière version 3.19 d'ArcGIS JS API. Ensuite, BaseMapGallery ne modifie pas la carte pour les couches Google. Il n'y a pas d'erreur sur la console.couche google map à BaseMapGallery API ArcGIS JS 3,19
Vous pouvez voir la démo en direct, je lui ai créé: https://jsbin.com/denoduquzi/edit?html,output
Si je passe simplement la version de l'API Esri à 3,17, il fonctionne très bien, mais il échoue lorsque vous passez à 3,18 ou 3,19
<title>Basemap gallery</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.19/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.19/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{
padding:0;
}
</style>
<script>
var djConfig = {
async: true,
packages: [
{ name: "agsjs", location: "https://maps.ngdc.noaa.gov/viewers/dijits/agsjs/xbuild/agsjs" }
]
};
</script>
<script src="https://js.arcgis.com/3.19/"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script>
var map;
require([
"esri/map", "esri/dijit/BasemapGallery", "esri/arcgis/utils",
"dojo/parser",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane","agsjs/layers/GoogleMapsLayer",
"dojo/domReady!"
], function(
Map, BasemapGallery, arcgisUtils,
parser
) {
parser.parse();
map = new Map("map", {
basemap: "topo",
center: [-105.255, 40.022],
zoom: 13
});
//add the basemap gallery, in this case we'll display maps from ArcGIS.com including bing maps
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
toggleReference: true,
google: {
apiOptions: {
v: '3.6'
}
},
map: map
}, "basemapGallery");
basemapGallery.startup();
basemapGallery.on("error", function(msg) {
console.log("basemap gallery error: ", msg);
});
});
</script>
<div data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline', gutters:false"
style="width:100%;height:100%;margin:0;">
<div id="map"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'"
style="padding:0;">
<div style="position:absolute; right:20px; top:10px; z-Index:999;">
<div data-dojo-type="dijit/TitlePane"
data-dojo-props="title:'Switch Basemap', closable:false, open:false">
<div data-dojo-type="dijit/layout/ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery"></div>
</div>
</div>
</div>
</div>
</div>
Merci beaucoup @hhkaos. –
De rien;) – hhkaos
Quelle bonne réponse! pouces vers le haut . @MohamedMouselhie vous devez l'accepter comme réponse! –