/** * * The SGMA Context varies base on the server environment. * * In development environment, the context will be SgmaApplicationWeb. * * * * @type String * */ var SGMA_CONTEXT = location.hostname == "localhost" ? "/portal" : "/portal"; /** * * The SGMA HOST will need to change if the webgis application is not on the same server as the SGMA Portal * * * * @type String * */ var SGMA_HOST = location.protocol + "//" + location.host + SGMA_CONTEXT; var layers = []; var uniqueIdCounter = 1; layers.push({ "type": "generic", "url": SGMA_HOST + "/service/gspdocument/planarea/30", "title": "GSP - 5-022.11 KAWEAH (Kaweah Subbasin - Greater Kaweah GSP)", "options": { "uniqueid": uniqueIdCounter++, "layerName": "GSP - 5-022.11 KAWEAH (Kaweah Subbasin - Greater Kaweah GSP)", "graphicsOpacity": 0.7, "filename": SGMA_HOST + "/service/gspdocument/planarea/30", "extension": "zip", "fileid": SGMA_HOST + "/service/gspdocument/planarea/30", "isFile": true, "parameters": [], "customSymbol": { "color": { "r": 40, "g": 128, "b": 191, "a": .85 },// color "outline": { "color": { "r": 255, "g": 255, "b": 255, "a": .85 },//color "width": 0.5, "type": "esriSLS", "style": "esriSLSSolid" },// outline "type": "esriSFS", "style": "esriSFSSolid" },// customSymbol "useIconMarker": false, "style": "circle", "symbol_size": "8" }, "layers": [{}], "startEnabled": true }); layers.push({ "type": "simple", "url": "https://gis.water.ca.gov/arcgis/rest/services/Geoscientific/i08_B118_CA_GroundwaterBasins/MapServer", "layers": [0], "startEnabled": true, "opacity": 0.90, "title": "Bulletin 118 Groundwater Basins (2018)" ,"options": { "uniqueid": uniqueIdCounter++, "reloaded": true ,"defaultZoomTo":true ,"layerName": "Bulletin 118 Groundwater Basins (2018)" ,"customSymbol":{ "type":"uniqueValue", "uvrJson":{ "uniqueValueInfos":[{ "label":"GSP Submittal" ,"value":"5-022.11" ,"symbol":{ "type": "esriSFS", "style": "esriSFSSolid", "color": [190, 232, 255, 255]/**/ ,"outline": { "type": "esriSLS", "style": "esriSLSSolid", "color": [0, 77, 168, 255], "width": 1 } } }] ,"field1":"Basin_Subbasin_Number" ,"fieldDelimiter":"," ,"type":"uniqueValue" } ,"allowFiltering":true }//end of customSymbol } }); layers.push({ "type": "simple", "url": "https://gis.water.ca.gov/arcgis/rest/services/Geoscientific/i08_B118_CA_GroundwaterBasins_2016/MapServer", "layers": [0], "startEnabled": false, "opacity": 0.72, "title": "Bulletin 118 Groundwater Basins (2016)", "options": { "uniqueid": uniqueIdCounter++, "reloaded": true, "events": {}, "layerName": "Bulletin 118 Groundwater Basins (2016)" ,"customSymbol": { "color": { "r": 255, "g": 237, "b": 182, "a": 0.5 }, "outline": { "color": { "r": 0, "g": 0, "b": 0, "a": 1 }, "width": 0.5, "type": "esriSLS", "style": "esriSLSSolid" }, "type": "esriSFS", "style": "esriSFSSolid" } } }); window.gsaServiceCounter = 3; configOptions = { "hideDescription": true, "title": "GSP Map Viewer", "titleUrl": SGMA_HOST + "/gsp", "tolerance": "6", "useGeometry": true, "hideNoData": true, "showLayerWin": false, "locations_uploader": true, "basemap_gallery": true, "showFullScreen": true, "style": "flat", "hideSingleTab": true, "infowinSaveData": {}, "events": { "onLayerLoad": function(service){ if (service.uniqueid == 2) {/* B118 2018 /**/ require(["esri/tasks/query", "esri/tasks/QueryTask","esri/graphicsUtils"], function(Query, QueryTask, graphicsUtils) { var q = new Query(); q.where = "Basin_Subbasin_Number = '5-022.11'"; q.returnGeometry = true; var qTask = new QueryTask(service.url + "/" + service.visibleLayers[0]); qTask.execute(q, function(results){ var extent = null; if ((extent = graphicsUtils.graphicsExtent(results.features))) { window.map.setExtent(extent); } }); }); } } ,onMapLoad:function(){ if (window.parent && window.parent.gspform) { window.parent.gspform.mapIsLoaded = true; } } }, "map": { "minZoom": "", "maxZoom": "16", "basemap": "topo", "extent": { "xmin": -1.447662069591413E7, "ymin": 3824908.166185502, "xmax": -1.242199337560914E7, "ymax": 5022217.777244184, "spatialReference": {"wkid": 102100} } }, "tabs": [{ "type": "empty", "enabled": true, "options": { "tabName": "Custom Tab 1", "off": true, "opacity": 0.72, "uniqueid": 12 }, "addtl": layers }], "hideTitleBar": true, "hideSearchBar": true, "hideEditTool": true, "hideDrawingTool": true, "hideFullscreenTool": true, "hasMultiAppAccess": false, "hideBookmarkTool": true, "hideEmbedTool": true, "hideSaveTool": true, "hidePrintTool": true, "hideMeasureTool": false, "hideLegendTool": false, "hideSelectedBoundary": false, "showDisclaimer": true, "disclaimer": "All information provided by the Department of Water Resources on its Web pages and Internet sites, is made available to provide immediate access for the convenience of interested persons. While the Department believes the information to be reliable, human or mechanical error remains a possibility. Therefore, the Department does not guarantee the accuracy, completeness, timeliness, or correct sequencing of the information. Neither the Department of Water Resources nor any of the sources of the information shall be responsible for any errors or omissions, or for the use or results obtained from the use of this information.", "login": {"requireLogin": false}, "title_option": "GSA Map Viewer", "disableMenuPanout": false, "hideToolsBar": true, "hideLayersTool": false, "hideBasemapTool": false, "makeInfowindowDraggable": true, "disableClicks": false, "featureSetInfowin": false, "infowindow_width": "", "infowindow_height": "", "layerWidthCfg": "", "hideLayerSettingsDropdown": true, "alwayShowLayerBar": true, "layerwindow_height": "300", "layerwindow_width": "", "appLabel": "", "useInfoGrid": false, "hideSelectTool": true, "hideLayerOptions": false ,"hideInFeatureTool" : true }; function convertMapToImage(callback) { if (typeof callback != "function") { callback=function(){console.log(arguments);} } require([ 'esri/tasks/PrintTask', 'esri/tasks/PrintParameters', 'esri/tasks/PrintTemplate' ], function (PrintTask, PrintParameters, PrintTemplate) { var printTask = new PrintTask('https://arcgis04.geiconsultants.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task' , {async: false});// false is require to call "execute", otherwise, it'll call "submitJob" var template = new PrintTemplate(); //Add configuration to image format here: template.exportOptions = { width: 1000, height: 1275, dpi: 96 }; template.format = "PNG8"; template.layout = "MAP_ONLY"; var params = new PrintParameters(); var map = app.map; params.map = map; params.template = template; console.log(params); printTask.execute(params , callback , function(error){alert(error);} ); }); }