function createMap(webmapitem) { var mapDeferred = esri.arcgis.utils.createMap(webmapitem, "map", { mapOptions: { slider: configOptions.displaySlider, sliderStyle: 'small', wrapAround180: !configOptions.constrainmapextent, showAttribution: true, //set wraparound to false if the extent is limited. logo: !configOptions.customlogo.image //hide esri logo if custom logo is provided }, ignorePopups: false, bingMapsKey: configOptions.bingmapskey }); mapDeferred.addCallback(function (response) { //add webmap's description to details panel if (configOptions.description === "") { if (response.itemInfo.item.description !== null) { configOptions.description = response.itemInfo.item.description; } } //initialExtent = response.map.extent; initialExtent = new esri.geometry.Extent({"xmin":-12345,"ymin":12345,"xmax":-12345,"ymax":12345,"spatialReference":{"wkid":102100}}); if (configOptions.extent) { var extent = new esri.geometry.Extent(dojo.fromJson(configOptions.extent)); initialExtent = extent; } configOptions.owner = response.itemInfo.item.owner; document.title = configOptions.title || response.itemInfo.item.title; //add a title if (configOptions.displaytitle === "true" || configOptions.displaytitle === true) { configOptions.title = configOptions.title || response.itemInfo.item.title; dojo.create("p", { id: 'webmapTitle', innerHTML: configOptions.title }, "header"); dojo.style(dojo.byId("header"), "height", "38px"); } else if (!configOptions.link1.url && !configOptions.link2.url) { //no title or links - hide header esri.hide(dojo.byId('header')); dojo.addClass(dojo.body(), 'embed'); dojo.query("html").addClass("embed"); } //get the popup click handler so we can disable it when measure tool is active clickHandler = response.clickEventHandle; clickListener = response.clickEventListener; map = response.map; //Constrain the extent of the map to the webmap's initial extent if (configOptions.constrainmapextent) { webmapExtent = response.map.extent.expand(1.5); } if (map.loaded) { initUI(response); } else { dojo.connect(map, "onLoad", function () { initUI(response); }); } map.setExtent(initialExtent); var MapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://mywebsite.com/arcgis/rest/services/Blah/MapServer"); map.addLayer(MapServiceLayer); }); mapDeferred.addErrback(function (error) { alert(i18n.viewer.errors.createMap + " : " + dojo.toJson(error.message)); }); }
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.