No the map doesn't have to be hosted on arcgis online. If you look at the sample I linked you'll see that we define the web map as follows - note that the urls to the map layers could point to your services. webmap.itemData = { "operationalLayers": [{ "url":layerURL, "visibility": true, "opacity": 0.75, "title": "Soil Survey Map", "itemId": "204d94c9b1374de9a21574c9efa31164" }], "baseMap": { "baseMapLayers": [{ "opacity": 1, "visibility": true, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer" },{ "isReference": true, "opacity": 1, "visibility": true, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer" }], "title": "World_Terrain_Base" }, "version": "1.1" };
webmap.itemData = { "operationalLayers": [{ "url":layerURL, "visibility": true, "opacity": 0.75, "title": "Soil Survey Map", "itemId": "204d94c9b1374de9a21574c9efa31164" }], "baseMap": { "baseMapLayers": [{ "opacity": 1, "visibility": true, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/World_Terrain_Base/MapServer" },{ "isReference": true, "opacity": 1, "visibility": true, "url": "http://services.arcgisonline.com/ArcGIS/rest/services/Reference/World_Reference_Overlay/MapServer" }], "title": "World_Terrain_Base" }, "version": "1.1" };
esri.arcgis.utils.createMap(webmap, "map");
/** * * Invoked when Flex viewer sends JSON map via event bus. * * @param data - JSON map */ function mapDataReceived(data) { var webmap = {}; webmap.item = { "title":"Soil Survey Map of USA", "snippet": "Detailed description of data", "extent": data.mapOptions.extent }; webmap.itemData = data; mapPromise = esri.arcgis.utils.createMap(webmap, "map"); var map; mapPromise.then(mapCreationSuccess, mapCreationFailed); } function mapCreationSuccess(response) { var map = response.map; var printTask = new esri.tasks.PrintTask(config.EXPORT_WEBMAP_URL); //TODO Change template to user options. var template = new esri.tasks.PrintTemplate(); template.exportOptions = { width: 500, height: 400, dpi: 96 }; template.format = "PDF"; template.layout = "MAP_ONLY"; template.preserveScale = false; var params = new esri.tasks.PrintParameters(); params.map = map; params.template = template; printTask.execute(params, printResult, printError); } function mapCreationFailed(error) { console.error("Unable to create map."); }
{ "exportOptions": { "outputSize":[892,550]}, "mapOptions": { "scale":141344140.17757848, "extent": { "ymin":-92.48878923766816, "ymax":92.48878923766816, "xmax":150, "spatialReference": { "wkid":4326 }, "xmin":-150} }, "operationalLayers": [{ "url":"https://IPAddressToArcGISServer/arcgis/rest/services/ServiceName/MapServer", "title":"BaseMap", "id":"BaseMap" }], "layoutOptions": { "legendOptions": { "operationalLayers": [{ "id":"BaseMap" }]}}}
Alejandro,You can use the esri.arcgis.utils.createMap method to build a map using input JSON. This JSON has to be in a particular format, see the doc here for details: http://resources.arcgis.com/en/help/arcgis-web-map-json/And see the help for a sample that shows this: http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/#sample/ags_createwebmapitem
Los miembros registrados pueden publicar, seguir actualizaciones y más. ¿Nuevo aquí? Regístrate gratis.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.