|
POST
|
This is absolutely not clean, just a quick POC for you, but it's a complete working example for what I think you're trying to do: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Basemap gallery</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{
padding:0;
}
</style>
<script src="https://js.arcgis.com/3.20/"></script>
<script>
var map;
require([
"esri/map",
"esri/dijit/BasemapGallery",
"esri/arcgis/utils",
"dojo/parser",
"dojo/_base/connect",
"dijit/MenuItem",
"dojo/_base/array",
"dijit/registry",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/TitlePane",
"dojo/domReady!"
], function(
Map, BasemapGallery, arcgisUtils,
parser, connect, MenuItem, array, registry
) {
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,
map: map
}, "basemapGallery");
basemapGallery.startup();
connect.connect(basemapGallery, 'onLoad', function () {
array.forEach(basemapGallery.basemaps, function (dynamicLayer) {
registry.byId("basemapMenu").addChild(new MenuItem({
label: dynamicLayer.title,
onClick: function () {
basemapGallery.select(dynamicLayer.id);
}
}));
});
});
basemapGallery.on("error", function(msg) {
console.log("basemap gallery error: ", msg);
});
});
</script>
</head>
<body class="claro">
<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:320px; top:145px; z-Index:1;">
<button id="dropdownButton" label="---Select a Basemap---" data-dojo-type="dijit/form/DropDownButton">
<div data-dojo-type="dijit/Menu" id="basemapMenu"></div>
</button>
</div>
<div style="position:absolute; right:20px; top:10px; z-Index:999; display:none;">
<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>
</body>
</html>
... View more
06-02-2017
11:33 AM
|
1
|
1
|
1501
|
|
POST
|
I have to wonder if Esri will need to make more progress with porting functionality from 3.x before we see more literature. There is still a bit of important functionality that needs to be ported, not to mention some bugs and intricacies resolved in 3.x that have cropped-up again in v4. I like the progress on the one hand, but on the other, we have invested years into creating a mature product based upon the 3.x line, Esri's suggestion to "re-write" rather than port 3.x-based applications really stings! IMHO, API upgrades shouldn't be so obtuse, but I understand the reasoning, and it is certainly not unprecedented. We re-wrote our mapping app from Silverlight (not even Esri-based) before switching to the JSAPI a few years ago.
... View more
05-17-2017
11:16 AM
|
2
|
4
|
3035
|
|
POST
|
Jonathan, That almost sounds like good fail safe behavior rather than a bug! Good info to know.
... View more
05-17-2017
11:08 AM
|
1
|
0
|
792
|
|
POST
|
Do you have any admin scripts managing perms? e.g. Example: Apply permissions to a service—ArcGIS Server Administration (Linux) | ArcGIS Enterprise I can see how a script this could easily apply perms to all services, unintended. Are there other admins on the machine that would have set the perms?
... View more
05-17-2017
06:56 AM
|
1
|
0
|
792
|
|
POST
|
Vatlteri, can you check the network inspector in dev tools, or maybe with Telerik Fiddler (my recommendation - Fiddler - Free Web Debugging Proxy - Telerik ), to debug the web traffic? Is there a proxy set in Chrome, by chance?
... View more
05-17-2017
06:12 AM
|
0
|
1
|
2509
|
|
POST
|
One thing to know about, if you don't already, ArcGIS Server has a stats page you can access: -> Login as admin -> Logs -> Statistics Here, you can check for timed-out requests in addition to total requests, by service. As far as your original question, you could roll your own, through something like a PowerShell or Python script... essentially, you'd create an http request every so often to evaluate responsiveness. You could send an e-mail if it were to time-out or become unavailable. Something else to check-out: System log Parser https://www.arcgis.com/home/item.html?id=90134fb0f1c148a48c65319287dde2f7 System Monitor (contains link to new version) http://www.arcgis.com/home/item.html?id=848f48b0f88e4de7a036377197453efe
... View more
05-16-2017
10:57 AM
|
1
|
0
|
822
|
|
POST
|
Brandon, I don't use Story Maps, but as far as I understand, when you download the example and host it on your server, you should be able to edit main-app.js Here's a reference example to the widget in 3.20, the version the story map example is using: Basemap gallery | ArcGIS API for JavaScript 3.20 I would add the reference to esri/dijit/BasemapGallery Then instantiate it: var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
basemapGallery.startup(); You'll need to add a front-end reference to the basemapGallery div, probably to index.html
... View more
05-16-2017
08:23 AM
|
0
|
1
|
1049
|
|
POST
|
Are you looking for something like this? Rockville Historic Buildings Catalog
... View more
05-16-2017
07:34 AM
|
0
|
3
|
1049
|
|
POST
|
I'm going to go out on a limb and say you'll need to provide more information - maybe a link you your app, or some code - before we can take a gander.
... View more
05-16-2017
07:28 AM
|
0
|
1
|
2509
|
|
POST
|
Esri confirmed it was a bug: BUG-000104782 - Getting error "Unable to complete operation" while printing searched location using Search Widget
... View more
04-27-2017
01:18 PM
|
1
|
2
|
2595
|
|
POST
|
Just a follow-up, I am working around this by hiding the infoWindow before the export initiates, then showing after modifying ioArgs within Esri request (which I needed to do for my other issue - https://community.esri.com/thread/193761-arcgis-jsapi-printvalidation-issue-syntaxerror-unexpected-token ). This looks similar to how infoWindow is handled for map services, when rendered during print exec. I'm going to mark this as "assumed answered" for now, but I notified Esri of the bug.
... View more
04-25-2017
01:10 PM
|
0
|
3
|
2595
|
|
POST
|
Wrote-up another incident: https://community.esri.com/message/682207-arcgis-jsapi-print-issue-error-executing-tool-layer-mapgraphics-᧖-failed-to-execute-export-web-map-failed-to-execute-export-web-map-task
... View more
04-25-2017
10:38 AM
|
0
|
0
|
1824
|
|
POST
|
The solution works, but I discovered another issue! I wrote this up as a separate incident (it looks like a genuine bug to me): https://community.esri.com/message/682207-arcgis-jsapi-print-issue-error-executing-tool-layer-mapgraphics-᧖-failed-to-execute-export-web-map-failed-to-execute-export-web-map-task
... View more
04-25-2017
10:37 AM
|
0
|
0
|
3013
|
|
POST
|
This issue came-up after resolving an IIS validation issue described here - ArcGIS JSAPI Print/Validation Issue: SyntaxError: Unexpected token < It seems similar to an issue reported awhile back here - Print Task fails with default Selected Point Graphic To replicate the issue, because a proxy is involved (and I wasn't able to hit the Esri proxy outside of an Esri domain), you'll have to use sandbox and manually paste code: ArcGIS API for JavaScript Sandbox 1) Copy the following code: <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<meta name="description" content="[Print webmap]">
<!--
ArcGIS API for JavaScript, https://js.arcgis.com
For more information about the widget_print_webmap sample, read the original sample description at developers.arcgis.com.
https://developers.arcgis.com/javascript/3/widget_print_webmap/index.html
-->
<title>Print webmap</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
h3 { margin: 0 0 5px 0; border-bottom: 1px solid #444; padding: 0 0 5px 0; text-align: center; }
.shadow {
-moz-box-shadow: 0 0 5px #888;
-webkit-box-shadow: 0 0 5px #888;
box-shadow: 0 0 5px #888;
}
#map{ margin: 0; padding: 0; }
#feedback {
background: #fff;
border: 2px solid #666;
border-radius: 5px;
bottom: 20px;
color: #666;
font-family: arial;
height: auto;
left: 20px;
margin: 5px;
padding: 10px;
position: absolute;
width: 300px;
z-index: 40;
}
#feedback a {
border-bottom: 1px solid #888;
color: #666;
text-decoration: none;
}
#feedback a:hover, #feedback a:active, #feedback a:visited {
border: none;
color: #666;
text-decoration: none;
}
#note { padding: 0 0 10px 0; }
#info { padding: 10px 0 0 0; }
</style>
<script src="https://js.arcgis.com/3.20/"></script>
<script>
var app = {};
require([
"esri/arcgis/utils", "esri/dijit/Print",
"esri/tasks/PrintTemplate", "esri/config",
"dojo/_base/array", "dojo/dom", "dojo/parser", "esri/dijit/Search",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
], function(
arcgisUtils, Print,
PrintTemplate, esriConfig,
arrayUtils, dom, parser, Search
) {
parser.parse();
app.webmapId = "523e292002294392a36d888a9780a731";
app.printUrl = "https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
esriConfig.defaults.io.proxyUrl = "/proxy/";
var webmap = arcgisUtils.createMap(app.webmapId, "map", {
mapOptions: {
center: [-85.673, 38.21],
zoom: 10
}
});
webmap.then(function(resp) {
app.mapInfo = resp.itemInfo.item;
app.map = resp.map;
createPrintDijit(app.mapInfo.title);
createSearch();
});
function createSearch(){
var search = new Search({
map: app.map
}, "search");
search.startup();
}
function createPrintDijit(printTitle) {
var layoutTemplate, templateNames, mapOnlyIndex, templates;
// create an array of objects that will be used to create print templates
var layouts = [{
name: "Letter ANSI A Landscape",
label: "Landscape (PDF)",
format: "pdf",
options: {
legendLayers: [], // empty array means no legend
scalebarUnit: "Miles",
titleText: printTitle + ", Landscape PDF"
}
}, {
name: "Letter ANSI A Portrait",
label: "Portrait (Image)",
format: "jpg",
options: {
legendLayers: [],
scalebarUnit: "Miles",
titleText: printTitle + ", Portrait JPG"
}
}];
// create the print templates
var templates = arrayUtils.map(layouts, function(lo) {
var t = new PrintTemplate();
t.layout = lo.name;
t.label = lo.label;
t.format = lo.format;
t.layoutOptions = lo.options;
return t;
});
app.printer = new Print({
map: app.map,
templates: templates,
url: app.printUrl
}, dom.byId("print_button"));
app.printer.startup();
}
});
</script>
</head>
<body class="tundra">
<div id="search"></div>
<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'">
<div id="feedback">
<h3>
ArcGIS.com Webmap and the Print Dijit
</h3>
<div id="info">
<div id="note">
Note: This sample uses an ArcGIS Server version 10.1 export web map task.
</div>
<div id="print_button"></div>
<div id="info">
The map is <a href="https://developers.arcgis.com/javascript/3/jsapi/esri.arcgis.utils-amd.html#createmap">created from an ArcGIS.com webmap</a> and
<a href="https://developers.arcgis.com/javascript/3/jsapi/printtemplate-amd.html">print templates</a> are
created manually. Refer to the documentation for more print template options (output formats, additional layouts, etc.).
</div>
</div>
</div>
</div>
</div>
</body>
</html> 2) Paste into the print widget sandbox example 3) Click "refresh" in the sandbox window 4) Print the page (PDF) without searching an address, which is successful -> Notice the following URL is hit in Fiddler (non proxy) -https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export... -> Here's the JSON sent: {
"mapOptions" : {
"showAttribution" : true,
"extent" : {
"xmin" : -9602504.8309441,
"ymin" : 4580852.692386033,
"xmax" : -9471644.63851983,
"ymax" : 4637416.093317086,
"spatialReference" : {
"wkid" : 102100
}
},
"spatialReference" : {
"wkid" : 102100
},
"scale" : 577790.5542889973
},
"operationalLayers" : [{
"id" : "World_Ocean_Base_5811",
"title" : "World_Ocean_Base",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"
}, {
"id" : "LOJIC_LandRecords_Louisville_4506",
"title" : "LOJIC_LandRecords_Louisville",
"opacity" : 0.28,
"minScale" : 0,
"maxScale" : 0,
"url" : "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer",
"visibleLayers" : [0, 2]
}, {
"id" : "World_Ocean_Reference_1604",
"title" : "World_Ocean_Reference",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer"
}
],
"exportOptions" : {
"outputSize" : [800, 1100],
"dpi" : 96
},
"layoutOptions" : {
"titleText" : "Louisville – Land Records, Landscape PDF",
"scaleBarOptions" : {
"metricUnit" : "esriKilometers",
"metricLabel" : "km",
"nonMetricUnit" : "esriMiles",
"nonMetricLabel" : "mi"
},
"legendOptions" : {
"operationalLayers" : []
}
}
} 5) Click "refresh" in the sandbox to reload 6) In the Search widget: -> "Louisville, Kentucky, United States" -> Search 7) Allow the geocode/plot process to complete (don't close anything) 😎 Print the page (PDF) after searching, which is not successful -> Notice the following URL is hit in Fiddler (proxy) - https://developers.arcgis.com/proxy/?https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools… -> Here's the JSON sent: {
"mapOptions" : {
"showAttribution" : true,
"extent" : {
"xmin" : -9579408.788718093,
"ymin" : 4599781.962824823,
"xmax" : -9513978.692506071,
"ymax" : 4631044.707393419,
"spatialReference" : {
"wkid" : 102100
}
},
"spatialReference" : {
"wkid" : 102100
},
"scale" : 288895.27714399697
},
"operationalLayers" : [{
"id" : "World_Ocean_Base_5811",
"title" : "World_Ocean_Base",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"
}, {
"id" : "LOJIC_LandRecords_Louisville_4506",
"title" : "LOJIC_LandRecords_Louisville",
"opacity" : 0.28,
"minScale" : 0,
"maxScale" : 0,
"url" : "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer",
"visibleLayers" : [0, 2]
}, {
"id" : "map_graphics",
"opacity" : 1,
"minScale" : 0,
"maxScale" : 0,
"featureCollection" : {
"layers" : [{
"layerDefinition" : {
"name" : "pointLayer",
"geometryType" : "esriGeometryPoint"
},
"featureSet" : {
"geometryType" : "esriGeometryPoint",
"features" : [{
"geometry" : {
"x" : -9546693.6798316,
"y" : 4615403.733083267,
"spatialReference" : {
"wkid" : 102100
}
},
"symbol" : {
"color" : [0, 0, 0, 0],
"size" : 12,
"angle" : 0,
"xoffset" : 6.75,
"yoffset" : 13.5,
"type" : "esriSMS",
"outline" : {
"color" : [0, 255, 255, 255],
"width" : 1.5,
"type" : "esriSLS",
"style" : "esriSLSSolid"
}
}
}, {
"geometry" : {
"x" : -9546693.6798316,
"y" : 4615403.733083267,
"spatialReference" : {
"wkid" : 102100
}
},
"attributes" : {
"Addr_type" : "POI",
"Match_addr" : "Louisville, Kentucky, United States",
"StAddr" : "",
"City" : "",
"score" : 100,
"searchTheme" : "arcgisSearch",
"searchResult" : "Louisville, Kentucky, United States",
"searchMoreResults" : "moreResults",
"searchMoreResultsItem" : "moreItem",
"searchMoreResultsId" : "search_more_results",
"searchMoreResultsHtml" : ""
},
"symbol" : {
"angle" : 0,
"xoffset" : 6.75,
"yoffset" : 13.5,
"type" : "esriPMS",
"url" : "https://js.arcgis.com/3.20/esri/dijit/Search/images/search-pointer.png",
"width" : 27,
"height" : 27
},
"infoTemplate" : {
"title" : "Search result",
"content" : "<div class=\"${searchTheme}\"><div id=\"${searchMoreResultsId}\" class=\"${searchMoreResults}\"><div class=\"${searchMoreResultsItem}\">${searchResult}</div><div>${searchMoreResultsHtml}</div></div></div>"
}
}
]
}
}
]
}
}, {
"id" : "World_Ocean_Reference_1604",
"title" : "World_Ocean_Reference",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer"
}
],
"exportOptions" : {
"outputSize" : [800, 1100],
"dpi" : 96
},
"layoutOptions" : {
"titleText" : "Louisville – Land Records, Landscape PDF",
"scaleBarOptions" : {
"metricUnit" : "esriKilometers",
"metricLabel" : "km",
"nonMetricUnit" : "esriMiles",
"nonMetricLabel" : "mi"
},
"legendOptions" : {
"operationalLayers" : []
}
}
} -> Notice the error in console (print does not complete): -> Error: Unable to complete operation. -> This will probably manifest on the server as an error like this: 9) Now, close the infoWindow only 10) Print the page (PDF), which should complete successfully (it does not hit the proxy) -> Here's the URL hit (again, notice no proxy this time) - https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task/execute -> Here's the JSON sent: {
"mapOptions" : {
"showAttribution" : true,
"extent" : {
"xmin" : -9579408.788718093,
"ymin" : 4599781.962824823,
"xmax" : -9513978.692506071,
"ymax" : 4631044.707393419,
"spatialReference" : {
"wkid" : 102100
}
},
"spatialReference" : {
"wkid" : 102100
},
"scale" : 288895.27714399697
},
"operationalLayers" : [{
"id" : "World_Ocean_Base_5811",
"title" : "World_Ocean_Base",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Base/MapServer"
}, {
"id" : "LOJIC_LandRecords_Louisville_4506",
"title" : "LOJIC_LandRecords_Louisville",
"opacity" : 0.28,
"minScale" : 0,
"maxScale" : 0,
"url" : "https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer",
"visibleLayers" : [0, 2]
}, {
"id" : "map_graphics",
"opacity" : 1,
"minScale" : 0,
"maxScale" : 0,
"featureCollection" : {
"layers" : [{
"layerDefinition" : {
"name" : "pointLayer",
"geometryType" : "esriGeometryPoint"
},
"featureSet" : {
"geometryType" : "esriGeometryPoint",
"features" : [{
"geometry" : {
"x" : -9546693.6798316,
"y" : 4615403.733083267,
"spatialReference" : {
"wkid" : 102100
}
},
"attributes" : {
"Addr_type" : "POI",
"Match_addr" : "Louisville, Kentucky, United States",
"StAddr" : "",
"City" : "",
"score" : 100,
"searchTheme" : "arcgisSearch",
"searchResult" : "Louisville, Kentucky, United States",
"searchMoreResults" : "moreResults",
"searchMoreResultsItem" : "moreItem",
"searchMoreResultsId" : "search_more_results",
"searchMoreResultsHtml" : ""
},
"symbol" : {
"angle" : 0,
"xoffset" : 6.75,
"yoffset" : 13.5,
"type" : "esriPMS",
"url" : "https://js.arcgis.com/3.20/esri/dijit/Search/images/search-pointer.png",
"width" : 27,
"height" : 27
},
"infoTemplate" : {
"title" : "Search result",
"content" : "<div class=\"${searchTheme}\"><div id=\"${searchMoreResultsId}\" class=\"${searchMoreResults}\"><div class=\"${searchMoreResultsItem}\">${searchResult}</div><div>${searchMoreResultsHtml}</div></div></div>"
}
}
]
}
}
]
}
}, {
"id" : "World_Ocean_Reference_1604",
"title" : "World_Ocean_Reference",
"opacity" : 1,
"minScale" : 591657527.591555,
"maxScale" : 9027.977411,
"url" : "https://services.arcgisonline.com/arcgis/rest/services/Ocean/World_Ocean_Reference/MapServer"
}
],
"exportOptions" : {
"outputSize" : [800, 1100],
"dpi" : 96
},
"layoutOptions" : {
"titleText" : "Louisville – Land Records, Landscape PDF",
"scaleBarOptions" : {
"metricUnit" : "esriKilometers",
"metricLabel" : "km",
"nonMetricUnit" : "esriMiles",
"nonMetricLabel" : "mi"
},
"legendOptions" : {
"operationalLayers" : []
}
}
} -> Here's a BC difference between the last two requests: This looks like a genuine bug to me! Any ideas? Thanks!
... View more
04-25-2017
10:37 AM
|
0
|
4
|
3416
|
|
POST
|
This appears to still be an issue with API v3.20, after obtaining results from the Search widget (e.g., geocoding an address).
... View more
04-25-2017
09:43 AM
|
0
|
1
|
1824
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2020 01:25 PM | |
| 1 | 03-20-2019 09:07 AM | |
| 2 | 07-31-2015 07:31 AM | |
| 1 | 09-14-2015 12:14 PM | |
| 1 | 05-12-2015 12:04 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-27-2023
02:30 AM
|