|
POST
|
Here's a modification of the dGrid example to just highlight the selected states. You can select multiple records in the grid using the mouse + Ctrl key.
function selectState(e) {
// select the feature
var fl = map.getLayer("states");
var query = new Query();
//query.objectIds = [parseInt(e.target.innerHTML)];
var selection = [];
var selected = window.grid.selection;
if (selected) {
for (row in selected) {
selection.push(parseInt(row));
}
}
query.objectIds = selection;
fl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function (result) {
if (result.length) {
// re-center the map to the selected feature
//window.map.centerAt(result[0].geometry.getExtent().getCenter());
} else {
console.log("Feature Layer query returned no features... ", result);
}
});
}
... View more
01-29-2014
05:56 AM
|
0
|
0
|
4118
|
|
POST
|
Have you thought of using dGrid instead? There's an example on how to use it, but the sample doesn't do anything with multiple selections (like highlighting multiple states). You'd have to changed the coding to deal with multiple selections. As for DataGrid, have you tried leaving off the selectionMode property, since the default is "extended"? Have you also tried adding programmatically like the examples here?
... View more
01-29-2014
03:59 AM
|
0
|
0
|
4118
|
|
POST
|
Also, take a look at this thread, which adds the check boxes dynamically and uses a Legend.
... View more
01-28-2014
05:55 AM
|
0
|
0
|
1614
|
|
POST
|
Can you put your code at JS Bin to show what you've done? I'm suspecting that you have the function "updateLayerVisibility" inside the require statement, where the check boxes cannot get access. Take a look at this thread
... View more
01-28-2014
04:17 AM
|
0
|
0
|
1614
|
|
POST
|
If I am understanding your question correctly, you are trying to add the services in a particular order. Instead of using addLayer after declaring each layer variable, you can use addLayers to add them in any order you want.
var WorldCountries1 = new esri.layers.ArcGISDynamicMapServiceLayer("mpasericeurl1");
//map.addLayer(WorldCountries1);
var WorldCountries = new ArcGISDynamicMapServiceLayer("arcgisUrl");
//WorldCountries.setOpacity(0.75);
console.log(" in map ");
//map.addLayer(WorldCountries);
map.addLayers([WorldCountries, WorldCountries1]);
//or map.addLayers([WorldCountries1, WorldCountries]);
... View more
01-28-2014
03:59 AM
|
0
|
0
|
545
|
|
POST
|
If you're talking about NLiu's TOC widget, you'll find the documentation here. By setting the visible layers for all the layers to -1, all groups will be collapsed.
... View more
01-27-2014
05:55 AM
|
0
|
0
|
4483
|
|
POST
|
The TOC is a remarkable tool and I salute NLui for developing it. However, when using Dynamic Layers, you'll always have to set the visible layers somehow, either with setVisibleLayers or a tool like this. If you delve into the code for NLui's TOC or Matt Driscoll's Layer Legend Widget, you'll see that they use setVisibleLayers.
... View more
01-24-2014
09:48 AM
|
0
|
0
|
1001
|
|
POST
|
To show some of the layers for a ArcGISDynamicMapServiceLayer, you have to use the setVisibleLayers method. Using the "/0" at the end of the URL is for FeatureLayers. var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer(serverURL, { "opacity": 0.5 } ); operationalLayer.setVisibleLayers([0]);
... View more
01-24-2014
08:15 AM
|
0
|
0
|
1001
|
|
POST
|
You have a problem with your require and the functions aliases. You had arrayUtil and array in the function aliases, but only "dojo/_base/array" in the require. require( ["dojo/parser", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/layout/AccordionContainer", "esri/map", "esri/dijit/BasemapToggle", "esri/layers/FeatureLayer", "dojo/on", "esri/dijit/Legend", "dojo/_base/array", "dijit/form/CheckBox", "dojo/dom-construct", "dojo/domReady!"], function (parser, BorderContainer, ContentPane, AccordionContainer, Map, BasemapToggle, FeatureLayer, on, Legend, arrayUtils, array, CheckBox, domConstruct) { Then in your code, you used array.forEach, which was where it was failing. I created a new Fiddle with known services that works as expected
... View more
01-24-2014
06:46 AM
|
0
|
0
|
3109
|
|
POST
|
Marianne, you can always put the information in something like a dGrid. While these are not using Feature Layers, there are a few examples where the results of a QueryTask or IdentifyTask are put into a dGrid. Missouri Legislative Analysis - try the "Search for Information by District" Washington State Spatial Prioritization Data Viewer - turn on several layers and click on the features
... View more
01-24-2014
06:10 AM
|
0
|
0
|
1409
|
|
POST
|
I think you and Mr. Neilsen are correct when it comes to .NET Add-ins because the references you add to your project are compiled to specific versions in Visual Studio. I don't have, haven't had so far, this problem with Java. Other than version specific changes to ArcObjects Java code that I mentioned regarding licensing constants. I'm sure this will probably change now that the cat is out of the bag. I'm not sure why more people aren't coding in Java in the ESRI platform. I thought about compiling a Top 10 Reasons to switch to Java for the New Year, but never got working on it. Have you tested whether anything you have written for 10.2 in Java is backwards compatible?
... View more
01-23-2014
04:06 AM
|
0
|
0
|
3549
|
|
POST
|
Your Add-in was written in Java? I just tested one today. A customer has an old Add-in (Java) that I gave them two years ago. I moved it to a 10.2 ArcMap to see what I needed to change and it works fine. Full disclosure, I am not doing anything version specific in this Add-in. If I had been checking the license level, I would have had to recompile it to use the correct esriLicenseProductCode constant. The Add-in edits a shapefile. This Add-in was in .NET. The problem it was having was writing output of a goeprocessing tool to a geodatabase. Once I changed the references, the output was created successfully.
... View more
01-22-2014
12:06 PM
|
0
|
0
|
3549
|
|
POST
|
Maybe in .NET, but in Java, I have an Add-in developed in 10.0 and it works fine in 10.2 with no code changes required. I would have agreed with you last week, but I just came across an example where an Add-in I created in 10.0 didn't quite work on 10.2. I opened the project in 10.2, updated the references (but made no other code changes) and recompiled it. It then worked correctly in 10.2
... View more
01-22-2014
12:00 PM
|
1
|
0
|
3549
|
|
POST
|
When I have a form with required parameters, I disable the OK button until everything required is fill out. Each control that is required runs a subroutine on its Click (or KeyPress or Changed etc) event that checks if all requirements have been met. If so, the button is enabled. Here's an example
Private Sub EnableRun()
If cboLayers.Text <> "" Then
If chkCreate.Checked Then
If txtIntersection.Text <> "" Then
btnOK.Enabled = True
Else
btnOK.Enabled = False
End If
Else
btnOK.Enabled = True
End If
Else
btnOK.Enabled = False
End If
End Sub
Private Sub chkCreate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkCreate.CheckedChanged
'do something
EnableRun()
End Sub
Private Sub txtIntersection_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtIntersection.TextChanged
'do something
EnableRun()
End Sub
... View more
01-22-2014
11:51 AM
|
0
|
0
|
1229
|
|
POST
|
The "layer-add-result" function will be fired when you add a basemap and change the basemap, in addition to when you add your Layer1. However, I didn't see it fire when scrolling in and out. This code shows that behavior <!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></title> <link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css"> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map { padding: 0; } </style> <script src="http://js.arcgis.com/3.8/"></script> <script> var map; require([ "esri/map", "esri/dijit/BasemapGallery", "esri/arcgis/utils", "dojo/parser", "esri/layers/ArcGISDynamicMapServiceLayer", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dijit/TitlePane", "dojo/domReady!" ], function ( Map, BasemapGallery, arcgisUtils, parser, ArcGISDynamicMapServiceLayer ) { 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(); var dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer", { "opacity": 0.5 }); map.addLayer(dynamicMapServiceLayer); map.on("layer-add-result", function (evt) { console.log("Layer add result event fired - " + evt.layer.id); }); map.on("layers-add-result", console.log("Layers add result event fired")) 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:20px; top:10px; z-Index:999;"> <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> As you can see, the event "layers-add-result" also fired, even though the code doesn't contain the line map.addLayers(dynamicMapServiceLayer); However, that event only fired once, regardless of how many times you changed the basemap or added additional layers. So you can still use the addLayer method to add a single layer to the map, but you should put the Legend initialization in the "layers-add-result" event. Or you could use map.addLayers([Layer1]);
... View more
01-22-2014
06:14 AM
|
0
|
0
|
920
|
| 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 |
Online
|
| Date Last Visited |
3 hours ago
|