POST
|
Hi all, I am trying to add additional widget placeholder (there are 5 currently by default, Iwant 6 or 7 placeholders) to the foldable theme with default layout for one of our applications and for some reasons I have not been successful yet. Here is what I am doing: 1) I go to stemapp>themes>FoldableTheme>layouts> default>config.json. 2) I add a widget placeholder by adding this code to the config.json file: { "position": { "left": 305, "top": 45 } }, Results: a new layout is highlighted in WAB the other layouts are all messed up: Any idea or help is welcome, Thanks, Alex
... View more
10-31-2016
11:46 AM
|
1
|
13
|
4460
|
POST
|
I am pretty new to web app builder. I am trying to customize it the way I want. I am trying to achieve something similar to that: In the JS API it would look like that. Not too sure how to recreate such a thing in WAB. //Create Home button
initialExtent = map.extent;
dojo.create("div", {
className: "esriSimpleSliderHomeButton",
title: 'Zoom to Full Extent',
onclick: function () {
if (initialExtent === undefined) {
initialExtent = map.extent;
}
map.setExtent(initialExtent);
}
}, dojo.query(".esriSimpleSliderIncrementButton")[0], "after"); Thanks, Alex
... View more
10-26-2016
01:02 PM
|
0
|
3
|
1852
|
POST
|
Hi all, I am trying to use Print template showAttribution option but cant make it work for some reasons. I dont want to show the map sources because it gets cut off sometimes when printing. Any idea? <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title></title>
<link rel="stylesheet" href="https://js.arcgis.com/3.16/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.16/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.16/"></script>
<script>
var app = {};
require([
"esri/arcgis/utils", "esri/dijit/Print",
"esri/tasks/PrintTemplate", "esri/config",
"dojo/_base/array", "dojo/dom", "dojo/parser",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
], function(
arcgisUtils, Print,
PrintTemplate, esriConfig,
arrayUtils, dom, parser
) {
parser.parse();
app.webmapId = "8315cf7d20f0484e869c4791f70f4f15";
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);
});
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.showAttribution = false;
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 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/jsapi/esri.arcgis.utils-amd.html#createmap">created from an ArcGIS.com webmap</a> and
<a href="https://developers.arcgis.com/javascript/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>
... View more
04-12-2016
10:50 AM
|
0
|
4
|
2998
|
POST
|
Hi All, I am trying to customize/modify attribution at bottom of the javascript API. Sometimes it gets too lengthy for the print widget and the source gets cut off. Is it possible to mess with it? Thanks, Alex
... View more
03-30-2016
11:46 AM
|
0
|
0
|
2053
|
POST
|
I actually found the issue in my code: it was here in this section of the code" map.on('layers-add-result', function (evt) { dynaLayer1.setVisibleLayers([0, 4, 5, , 6, 7, 8, 9, 19]); toc = new TOC({ map: map, layerInfos: [{ layer: dynaLayer1, title: "Layers" }] }, 'tocdiv'); toc.startup(); }); I removed this line: dynaLayer1.setVisibleLayers([0, 4, 5, , 6, 7, 8, 9, 19]); It is all back to normal now.
... View more
03-30-2016
09:47 AM
|
0
|
0
|
908
|
POST
|
I am using this function to check if layers are visible and push layers that are visible or not: dynaLayer1.on('visible-layers-change', function (e, index) { visible.length = 0; console.log('The layer(s) changed: ', e.visibleLayers.join(', ')); visible.push(e.visibleLayers) }); When loading the map it indicates that these layers IDs are visible: The layer(s) changed: 0, 4, 5, , 6, 7, 8, 9, 19 However, since I am dealing with scale dependent layers, the layer id 0 is not visible for instance when loading the map at an extent that shows all California. Not too sure how to address that issue.
... View more
03-30-2016
09:25 AM
|
0
|
0
|
908
|
POST
|
Hi all, I encountering a problem I have never had to deal with before. I am trying to use the identify widget to return attributes from multiple layers when clicked on. The issue is that it sometimes returns duplicates. Not sure why. Here is my code: 1) The Identify params are called in the map.on load map.on("load", function () {
//coordinates on load
map.on("mouse-move", showCoordinates);
map.on("mouse-drag", showCoordinates);
map.on("extent-change", showScale);
//Show coordinates in bottom left corner of map
function showCoordinates(evt) {
//the map is in web mercator but display coordinates in geographic (lat, long)
var mp = webMercatorUtils.webMercatorToGeographic(evt.mapPoint);
//display mouse coordinates
dom.byId("info").innerHTML = 'X, Y: ' + mp.x.toFixed(3) + ", " + mp.y.toFixed(3);
}
function showScale() {
var currentScale = map.getScale();
dom.byId("scaleVis").innerHTML = 'Scale 1:' + currentScale.toFixed(0);
}
var currentScale = map.getScale();
dom.byId("scaleVis").innerHTML = 'Scale 1:' + currentScale.toFixed(0);
var visible = [];
dynaLayer1.on('visible-layers-change', function (e, index) {
visible.length = 0;
console.log('The layer(s) changed: ', e.visibleLayers.join(', '));
visible.push(e.visibleLayers)
});
//create identify tasks and setup parameters
identifyTask = new IdentifyTask(dynaLayer1.url);
identifyParams = new IdentifyParameters();
identifyParams.tolerance = 3;
identifyParams.returnGeometry = true;
identifyParams.layerIds = visible;
identifyParams.layerOption = IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.width = map.width;
identifyParams.height = map.height;
//Create Home button
initialExtent = map.extent;
dojo.create("div", {
className: "esriSimpleSliderHomeButton",
title: 'Zoom to Full Extent',
onclick: function () {
if (initialExtent === undefined) {
initialExtent = map.extent;
}
map.setExtent(initialExtent);
}
}, dojo.query(".esriSimpleSliderIncrementButton")[0], "after");
var GraphicsTHP = new GraphicsLayer();
GraphicsTHP.id = 'graphicsTHP';
// Add the graphic and Layers here
map.addLayers([dynaLayer2, dynaLayer1, GraphicsTHP]);
dynaLayer2.hide();
});//End of on load stuff here 2) My function that executes the identify function executeIdentifyTask(event) {
$("#dialog").dialog("close");
identifyParams.geometry = event.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask
.execute(identifyParams)
.addCallback(function (response) {
// response is an array of identify result objects
// Let's return an array of features.
return arrayUtils.map(response, function (result, index) {
var feature = result.feature;
var layerName = result.layerName;
feature.attributes.layerName = layerName;
if (layerName === 'Timber Harvest Plans') {
var THPs1 = new InfoTemplate("Timber Harvest Plans",
"<b>County: </b>${County}<br/>" +
"<b>HarvestDoc_Num: </b>${HarvestDoc_Num}<br/>" +
"<b>Silviculture: </b>${Silviculture}<br/>" +
"<b>Silviculture2: </b>${Silviculture2}<br/>" +
"<b>HarvestDoc_Num: </b>${HarvestDoc_Num}<br/>" +
"<b>Yarding: </b>${Yarding}<br/>" +
"<b>Status_of_Plan: </b>${Status_of_Plan}<br/>" +
"<b>Timber_Owner: </b>${Timber_Owner}<br/>" +
"<b>Landowner: </b>${Landowner}<br/>" +
"<b>Acres: </b>${Acres}<br/>"
);
feature.setInfoTemplate(THPs1);
}
else if (layerName === 'Public Land Survey System - Township, Range, & Section') {
var test = new InfoTemplate("PLSS",
"<b>SECTION: </b>${SECTION}<br/>" +
"<b>MERIDIAN: </b>${CDFPWSNAME}<br/>" +
"<b>TOWNSHIP: </b>${TOWNSHIP}<br/>" +
"<b>RANGE: </b>${RANGE}<br/>" +
"<b>MERIDIAN: </b>${MERIDIAN}<br/>"
);
feature.setInfoTemplate(test);
}
else if (layerName === 'Emergency Notices (King Fire, 2014)') {
var THPs2 = new InfoTemplate("Emergency Notices",
"<b>Acres: </b>${Acres}<br/>" +
"<b>OWNER: </b>${OWNER}<br/>" +
"<b>STATUS: </b>${STATUS}<br/>" +
"<b>EMERGENCYNUM: </b>${EMERGENCYNUM}<br/>" +
"<b>Treatment: </b>${Treatment}<br/>"
);
feature.setInfoTemplate(THPs2);
}
else if (layerName === 'Coastal Anadromy Zone (NOAA NMFS)') {
var NOAA = new InfoTemplate("Coastal Anadromy Zone",
"<b>Area Type: </b>${Area Type}<br/>");
feature.setInfoTemplate(NOAA);
}
else if (layerName === 'Calwater - Planning Watersheds') {
var Calwater = new InfoTemplate("Planning Watersheds",
"<b>CALWNUM: </b>${CALWNUM}<br/>" +
"<b>CDFPWSNAME: </b>${CDFPWSNAME}<br/>" +
"<b>Coho_ESU_Status: </b>${Coho_ESU_Status}<br/>" +
"<b>Chinook_ESU_Status: </b>${Chinook_ESU_Status}<br/>" +
"<b>Steelhead_DPS_Status: </b>${Steelhead_DPS_Status}<br/>" +
"<b>Coho_Restorability: </b>${Coho_Restorability}<br/>" +
"<b>Steelhead_Restorability: </b>${Steelhead_Restorability}<br/>" +
"<b>UpStream_ASP: </b>${UpStream_ASP}<br/>" +
"<b>Coastal_Anadromy_Zone_FPRs: </b>${Coastal_Anadromy_Zone_FPRs}<br/>" +
"<b>Status_303d_2010: </b>${Status_303d_2010}<br/>" +
"<b>County: </b>${County}<br/>" +
"<b>Acres: </b>${Acres}<br/>");
feature.setInfoTemplate(Calwater);
}
else if (layerName === 'Special Treatment Areas') {
var Calwater3 = new InfoTemplate("Special Treatment Areas",
"<b>Area_Type: </b>${Area_Type}<br/>" +
"<b>Area_Name: </b>${Area_Name}<br/>" +
"<b>County: </b>${County}<br/>" +
"<b>Quad_Name: </b>${Quad_Name}<br/>"
);
feature.setInfoTemplate(Calwater3);
}
else if (layerName === 'Coastal Zone Boundary') {
var Calwater4 = new InfoTemplate("Coastal Zone Boundary",
"<b>AREA_TYPE: </b>${AREA_TYPE}<br/>" +
"<b>CODE_SOURCE: </b>${CODE_SOURCE}<br/>"
);
feature.setInfoTemplate(Calwater4);
}
else if (layerName === '303(d) Channels, 2010') {
var Calwater8 = new InfoTemplate("303(d) Channel 2010",
"<b>TDCKEY: </b>${TDCKEY}<br/>" +
"<b>RF3RCHID: </b>${RF3RCHID}<br/>" +
"<b>PNAME: </b>${PNAME}<br/>" +
"<b>PNMCD: </b>${PNMCD}<br/>" +
"<b>RFORGFLAG: </b>${RFORGFLAG}<br/>" +
"<b>UPDATE2: </b>${UPDATE2}<br/>" +
"<b>UPDTCD2: </b>${UPDTCD2}<br/>" +
"<b>UPDTSRC2: </b>${UPDTSRC2}<br/>" +
"<b>FILLER: </b>${FILLER}<br/>" +
"<b>WBID: </b>${WBID}<br/>" +
"<b>WBNAME: </b>${WBNAME}<br/>" +
"<b>REGION: </b>${REGION}<br/>" +
"<b>REGION_NM: </b>${REGION_NM}<br/>" +
"<b>WBTYPE: </b>${WBTYPE}<br/>" +
"<b>WBTYPE_NM: </b>${WBTYPE_NM}<br/>"
);
feature.setInfoTemplate(Calwater8);
}
else if (layerName === '303(d) Waterbodies, 2010') {
var Calwater9 = new InfoTemplate("303(d) Waterbody 2010",
"<b>WATER: </b>${WATER}<br/>" +
"<b>NAME: </b>${NAME}<br/>" +
"<b>WRCBLAKES: </b>${WRCBLAKES}<br/>" +
"<b>GNIS_ID: </b>${GNIS_ID}<br/>" +
"<b>IFDKEY: </b>${IFDKEY}<br/>" +
"<b>WBID: </b>${WBID}<br/>" +
"<b>WBNAME: </b>${WBNAME}<br/>" +
"<b>REGION: </b>${REGION}<br/>" +
"<b>REGION_NM: </b>${REGION_NM}<br/>" +
"<b>WBID: </b>${WBID}<br/>" +
"<b>WBTYPE: </b>${WBTYPE}<br/>" +
"<b>WBTYPE_NM: </b>${WBTYPE_NM}<br/>"
);
feature.setInfoTemplate(Calwater9);
}
else if (layerName === 'Rainfall 1900 – 1960 (USGS)') {
var Calwater5 = new InfoTemplate("Rainfall 1900 – 1960",
"<b>Mean Annual Rainfall (inches): </b>${Mean Annual Rainfall (inches)}<br/>"
);
feature.setInfoTemplate(Calwater5);
}
else if (layerName === 'Coho Status') {
var Calwater6 = new InfoTemplate("Coho Status",
"<b>ESU/DPS: </b>${ESU/DPS}<br/>" +
"<b>Status: </b>${Status}<br/>" +
"<b>Class: </b>${Class}<br/>"
);
feature.setInfoTemplate(Calwater6);
}
else if (layerName === 'Chinook Status') {
var Calwater10 = new InfoTemplate("Chinook Status",
"<b>ESU/DPS: </b>${ESU/DPS}<br/>" +
"<b>Status: </b>${Status}<br/>" +
"<b>Class: </b>${Class}<br/>"
);
feature.setInfoTemplate(Calwater10);
}
else if (layerName === 'Steelhead Status') {
var Calwater16 = new InfoTemplate("Steelhead Status",
"<b>ESU/DPS: </b>${ESU/DPS}<br/>" +
"<b>Status: </b>${Status}<br/>" +
"<b>Class: </b>${Class}<br/>"
);
feature.setInfoTemplate(Calwater16);
}
else if (layerName === 'Forest Districts') {
var Calwater20 = new InfoTemplate("Forest Districts",
"<b>Name: </b>${Name}<br/>"
);
feature.setInfoTemplate(Calwater20);
}
else if (layerName === 'CA County Boundaries') {
var Calwater8 = new InfoTemplate("County Boundary",
"<b>County Name: </b>${County Name}<br/>"
);
feature.setInfoTemplate(Calwater8);
}
return feature;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(event.mapPoint);
} Any idea is welcome. Thanks, Alex
... View more
03-29-2016
04:21 PM
|
0
|
3
|
2926
|
POST
|
I actually do have one question about it. Reading a little bit the documentation about "esri/dijit/BasemapLayer". I says: "Defines a layer that will be added to a basemap and displayed in the BasemapGallery dijit." Does it need basemap gallery to work?
... View more
03-22-2016
09:42 AM
|
0
|
2
|
1606
|
POST
|
Hi all, I have two Tiled services: USA_Topo_Maps (MapServer) World_Topo_Map (MapServer) esriBasemaps.usgs = {
baseMapLayers: [{ url: "http://basemap.nationalmap.gov/arcgis/rest/services/USGSTopo/MapServer" }],
};
esriBasemaps.USATopo = {
baseMapLayers: [{ url: "http://services.arcgisonline.com/ArcGIS/rest/services/USA_Topo_Maps/MapServer" }],
}; I want these two layers to become 1 basemap layer with ID so I can set Opacity on this layer. map.getLayer(map.basemapLayerIds).setOpacity(ui.value / 100); Is there a way to do that? Would it be possible with a mix dynamic/tiled service as well?
... View more
03-21-2016
03:12 PM
|
0
|
5
|
3333
|
POST
|
Hi all, I am trying to use a great Print widget created by David Spriggs in my web app. Although it works great, from time to time, I get a dojo loader error thrown at me. I noticed the same error on his github. A pic of the error I get in debugger is attached below. Script is following: <script>
var dojoConfig = { isDebug: true };
</script>
<script type="text/javascript">
var dojoConfig = {
async: true,
packages: [{
name: "gis",
location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/gis/"
}, {
name: "dbootstrap",
location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/dbootstrap"
}, {
name: "xstyle",
location: location.pathname.replace(/[^\/]+$/, '') + "Widget/Print/dbootstrap"
},
{
name: "agsjs",
location: location.pathname.replace(/[^\/]+$/, '') + "Widget/toc/2.10/src/agsjs/"
}
]
};
</script> Any idea what's wrong? Thank you, Alex
... View more
01-06-2016
01:38 PM
|
0
|
1
|
2786
|
POST
|
Hi all, I am using JQuery and bootstrap in my map and cant seem to be able to use or see the "+" and "-" expand/collapse dijit that comes along with the TOC widget. Any idea why? My code is here. Thank you, Alex
... View more
11-19-2015
03:53 PM
|
0
|
1
|
2312
|
Title | Kudos | Posted |
---|---|---|
1 | 10-31-2016 11:46 AM | |
1 | 10-15-2014 02:17 PM | |
1 | 11-19-2015 09:14 AM | |
1 | 10-29-2015 04:38 PM | |
1 | 02-02-2015 09:55 AM |
Online Status |
Offline
|
Date Last Visited |
11-05-2021
12:09 PM
|