|
POST
|
Your dependencies aren't loaded in the correct order. For example, you attempt to load "esri/arcgis/utils", "dojo/parser" and "dojo/ready" but there's no variable assignment in the following function. The variable names in the function have to be in the same order as modules in the require (which they appear to be in this case), but the modules loaded in the require part don't necessarily need a variable name in the function. These just have to come after the last module with a variable name.
... View more
12-19-2013
04:24 AM
|
0
|
0
|
3614
|
|
POST
|
Edward, If Janice's post answered your question (or helped you out), you should click the check mark and/or the up arrow in her post. You've posted many questions and have received many answers, but you haven't marked any posts (including your own) as having answered your questions. Marking the thread as answered helps others who are looking for answers to these questions in the future. It also rewards the people who help you through the MVP program.
... View more
12-19-2013
03:46 AM
|
0
|
0
|
2931
|
|
POST
|
By doing some searching in the 10.2 help, I was able to find the cursor methods and properties in the ESRI.ArcGIS.ADF.Local assembly here. These types of assemblies cannot be loaded with the "Add ArcGIS reference", but will be found in the "Add Reference" dialog.
... View more
12-17-2013
11:51 AM
|
0
|
0
|
974
|
|
POST
|
Thanks Jake, Could the documentation be changed to reflect this better? Right now, the code snippet doesn't show the need to get the extent of the graphic. Currently, it is just var extent = map.extent;
if(extent.contains(graphic.geometry)) {
graphic.setSymbol(highlightSymbol);
} In my case, since I know the input graphics will always have the same spatial reference, I can use
function flashFeature(graphic) {
var text, extent;
if (graphic.geometry.type == "point") {
extent = graphic.geometry;
text = "Point: " + graphic.geometry.x + ", " + graphic.geometry.y;
}
else if (graphic.geometry.type == "polyline") {
extent = graphic.geometry.getExtent();
text = "Line: " + extent.xmin + ", " + extent.ymin + ", " + extent.xmax + ", " + extent.ymax;
}
if (!map.extent.contains(extent)) {
console.log("Outside current extent - " + text);
}
else {
console.log("Inside current extent - " + text);
}
map.graphics.add(graphic);
}
... View more
12-17-2013
10:29 AM
|
0
|
0
|
1523
|
|
POST
|
I am using Extent.contains in a function to see if a graphic is inside the current map extents before I do some effects with it. The effect crashes if the graphic is not within the map's extent. This function receives points and lines, both of which are in the same dynamic map service with the same spatial reference (10200). I've set up an example in JSBin to show this. It queries the line layer, checks whether it's within the map extent, and adds the graphic to the map. It does the same to the point layer. The console reports the map extent and the feature extent. Evaluating the point returns true, but the line returns false. Why isn't the line feature seen as being inside the map extent?
... View more
12-17-2013
09:30 AM
|
0
|
2
|
2567
|
|
POST
|
You can set the outline property of the SimpleFillSymbol. See this snippet to show how to do this. Here are the prebuilt line styles in the esriSimpleLineStyle constants
... View more
12-13-2013
03:31 AM
|
0
|
0
|
723
|
|
POST
|
Here's a sample that shows how to do that with a gif and here's one with text.
... View more
12-12-2013
06:14 AM
|
0
|
0
|
1973
|
|
POST
|
Doug, You should click the check mark on your post to help those who are searching for an answer on this question.
... View more
12-11-2013
07:16 AM
|
0
|
0
|
1562
|
|
POST
|
Tracy, You can hide layers in the TOC using the syntax
toc.findTOCNode(layer, layerId).hide();
Take a look at this sample. In one of my applications, I have an array of layerIds I want to show in the TOC. Here's the code I use to hide all the other entries in the TOC. This does require that the map service is at 10.1. Note that it has to be in the load event of the TOC if you want to hide them at design time.
function createTOC() {
try {
var toc = new TOC({
map: map,
layerInfos: layerInfo
}, "divLayers");
toc.startup();
}
catch (e) {
console.log(e.message);
}
toc.on("load", function () {
for (var k = 0; k < layerInfo.length; k++) {
var layer = layerInfo .layer;
var layersArray = layerInfo .layerList;
if (layersArray != null) {
var dynamicLayerInfos = layer.createDynamicLayerInfosFromLayerInfos();
for (var j = 0; j < dynamicLayerInfos.length; j++) {
toc.findTOCNode(layer, dynamicLayerInfos .id).hide(); //hide all the layers
for (var i = 0; i < layersArray.length; i++) {
if (dynamicLayerInfos .id == layersArray.id) {
toc.findTOCNode(layer, dynamicLayerInfos .id).show(); //only show the layers in the dynamicLayerInfos array
}
}
}
}
}
});
}
This is the layerInfo object
layerInfo = [{ layer: layerBenthic, title: "Benthic Data", slider: true, layerList: benthicLayers }];
The layerList array looks like this
benthicLayers: [
{
label: "Boundaries",
id: 72,
showLayer: true
},
{
label: "Structure",
id: 75,
showLayer: true
},
{
label: "Biological Cover",
id: 73,
showLayer: true
},
{
label: "Live Coral Cover",
id: 74,
showLayer: true
},
{
label: "Percent Hardbottom",
id: 76,
showLayer: true
},
{
label: "Zone",
id: 77,
showLayer: true
}
... View more
12-11-2013
04:25 AM
|
2
|
5
|
3078
|
|
POST
|
Currently, coding in AMD style is not supported yet for code assist. Will that be fixed in the 3.8 release?
... View more
12-06-2013
06:21 AM
|
0
|
0
|
2448
|
|
POST
|
I had this problem when using dGrids. Take a look at this thread for the way I solved it.
... View more
12-03-2013
03:52 AM
|
0
|
1
|
1865
|
|
POST
|
It turns out that this capability exists in the current TOC version. You can use toc.findTOCNode(layerDynamic, 1).hide(); to remove layer 1 and toc.findTOCNode(layerDynamic, 1).show(); to make it visible again. See this sample. It will affect the Fire Stations legend entry. If you want to do this when the TOC is being created, you'll have to put it into the Load event map.on("layers-add-result", function (evt) { toc = new TOC({ map: map, layerInfos: [{ layer: layerDynamic, title: "Legend", slider: true }] }, 'legendDiv'); toc.startup(); toc.on("load", function () { toc.findTOCNode(layerDynamic, 1).hide(); }); });
... View more
12-02-2013
10:28 AM
|
0
|
0
|
2513
|
|
POST
|
Unfortunately, neither of those work. I can see the visible attribute within lyr.data, but how do I set that to false? [ATTACH=CONFIG]29504[/ATTACH]
... View more
12-02-2013
09:18 AM
|
0
|
0
|
2513
|
|
POST
|
Can you post your revised code? This works for me <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices--> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>Map with legend</title> <link rel="stylesheet" href="http://js.arcgis.com/3.7/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.7/js/esri/css/esri.css"> <style> html, body { height: 97%; width: 98%; margin: 1%; } #rightPane { width: 20%; } #legendPane { border: solid #97DCF2 1px; } .esriLegendServiceLabel { /*visibility: hidden;*/ display: none; } .esriLegendLayerLabel { /*visibility: hidden;*/ /*display: none;*/ } .esriLegendLeft { padding-left: 0px; } </style> <script src="http://js.arcgis.com/3.7/"></script> <script> var map; require([ "esri/map", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/FeatureLayer", "esri/dijit/Legend", "dojo/_base/array", "dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer", "dojo/domReady!" ], function ( Map, ArcGISDynamicMapServiceLayer, FeatureLayer, Legend, arrayUtils, parser ) { parser.parse(); map = new Map("map", { basemap: "topo", center: [-117.4408, 33.4419], zoom: 9 }); var dynamicLayer = new ArcGISDynamicMapServiceLayer("http://www.sawpa.net/arcgissawpa/rest/services/CEDEN_TMDL/MapServer", { }); var featureLayer = new FeatureLayer("http://www.sawpa.net/arcgissawpa/rest/services/CEDEN_TMDL/MapServer/0", { }); //add the legend map.on("layers-add-result", function (evt) { var layerInfo = arrayUtils.map(evt.layers, function (layer, index) { return { layer: layer.layer, title: layer.layer.name }; }); if (layerInfo.length > 0) { var legendDijit = new Legend({ map: map, layerInfos: layerInfo }, "legendDiv"); legendDijit.startup(); } }); map.addLayers([dynamicLayer]); }); </script> </head> <body class="claro"> <!--[if IE 7]> <style> html, body { margin: 0; } </style> <![endif]--> <div id="content" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline', gutters:true" style="width: 100%; height: 100%; margin: 0;"> <div id="rightPane" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'right'"> <div data-dojo-type="dijit/layout/AccordionContainer"> <div data-dojo-type="dijit/layout/ContentPane" id="legendPane" data-dojo-props="title:'Legend', selected:true"> <div id="legendDiv"></div> </div> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="title:'Pane 2'"> This pane could contain tools or additional content </div> </div> </div> <div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'" style="overflow: hidden;"> </div> </div> </body> </html>
... View more
12-02-2013
07:19 AM
|
0
|
0
|
1424
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Offline
|
| Date Last Visited |
20 hours ago
|