POST
|
I've created a TOC with a lot of help but in the end what I am doing is creating a layer based on some filters. So what I want to do is add the layer with the filters and then if someone runs it again it removes the old layer and adds a new layer with the same name but with the new filters. Where I am having problems is removing the layer out of the Table of Contents. So if you click on my example below and click the get results button twice you will see that my "StoresResultsLayer" is showing twice. I only want it to show once. So how do you remove a layer from the TOC? http://jsfiddle.net/bearcatrunner/y4hwhoge/5/embedded/result/
... View more
10-03-2014
11:10 AM
|
0
|
1
|
3039
|
POST
|
Thanks Robert: AWESOME! Is their a simple way to copy the code you put in above into notepad++ with out the line numbers? For those of you following at home Robert changed my example a little and I didn't want to change the way the event of my button was initiated so I just tweaked his code a little with the bolded part and it worked!!! var h = StoresResultsLayer.on("load", function () { toc.layerInfos.splice(3, 0, { layer: StoresResultsLayer, title: "StoresResultsLayer" }); toc.refresh(); toc.on('load', function (evt) { toc.findTOCNode(StoresResultsLayer, 0).hide(); toc.findTOCNode(StoresResultsLayer, 1).hide(); toc.findTOCNode(StoresResultsLayer, 2).hide(); }); h.remove(); });
... View more
10-03-2014
07:04 AM
|
0
|
0
|
324
|
POST
|
Ken I am still having issues with this but you already answered my original question so I opened a new one out of respect for you and the point system I think you get for answering questions. Here is a link to the new question and thanks for all of your help. https://community.esri.com/message/426872#426872
... View more
10-03-2014
05:22 AM
|
0
|
0
|
617
|
POST
|
I am trying to hide two layers in my example provided called states and counties. I am trying to use this code to make it happen but I am getting a rootLayer reference error. Not sure why. //SCRIPT5007: Unable to get property 'rootLayer' of undefined or null reference //TOC.js, line 906 character 3 //if (serviceLayerId !== null && serviceLayerId !== undefined && w.rootLayer instanceof (ArcGISDynamicMapServiceLayer)) { toc.findTOCNode(StoresResultsLayer, 2).hide(); //hide States in legend toc.findTOCNode(StoresResultsLayer, 3).hide(); // hide counties in legend I created a simple fiddle in hopes that it helps one of you smarter people to help me. Thanks and happy Friday! Edit fiddle - JSFiddle
... View more
10-03-2014
05:21 AM
|
0
|
2
|
1235
|
POST
|
It was all because I was using var toc = new TOC . ..... instead of toc = new TOC. I know you can setVisibleLayers for a ArcGISDynamicMapServiceLayer but can you hide layers in your DSL in the TOC. I have 5 layers inside my DSL but I only want to show 3 and 4.
... View more
10-02-2014
11:02 AM
|
0
|
2
|
617
|
POST
|
I know it is something simple here. I have a feeling it doesn't recogonize my TOC. I am using this in a function. The alert box with "Found Load" fires off and if I take out the TOC code the layer loads with my expected results. I have a feeling it is having an issue with seeing the toc. I'm getting this error "ReferenceError: 'toc' is undefined "
... View more
10-02-2014
07:52 AM
|
0
|
4
|
617
|
POST
|
I tried this but it does not seem to be working. Not sure I understand the splice piece of this at all. var h = StoresResultsLayer.on('load', function (results) { toc.layerInfos.splice(1, 0, { layer: StoresResultsLayer, title: "StoresResultsLayer", // collapsed: true, // whether this root layer should be collapsed initially, default false. slider: true, // whether to display a transparency slider. autoToggle: false //whether to automatically collapse when turned off, and expand when turn on for groups layers. default true. }); toc.refresh(); // h.remove(); }); map.addLayer(StoresResultsLayer);
... View more
10-02-2014
06:34 AM
|
0
|
6
|
617
|
POST
|
I have my layers that I load up during the initial start up of my map that you can see below. However, I have a layer that I add in later like this: StoresResultsLayer.setVisibleLayers([3, 4]); map.addLayer(StoresResultsLayer); I would like this to show up in my table of contents but I would also like to allow the user the ability to turn the individual layers on and off as well. I'm going to have one be my results for my layer and the other will be labeling for those layers. How can I do this? Below is my code on startup for the TOC map.on("layers-add-result", function (results) { var toc = new TOC({ map: map, layerInfos: [{ layer: dlDRegionDistrictPolygons, title: "Boundary Files", collapsed: true, showGroupCount: false, slider: true },{ layer: dlMCY_Stores, title: "Macys Stores", collapsed: true } ] }, 'sliderDiv'); toc.startup(); toc.on('toc-node-checked', function (evt) { // When dlMCY_Stores is turned off I want flMCY_Stores_Labels to turn off as well and vice versa. if(dlMCY_Stores.visible == true){ //Show feature layer Labels because dynamic layers allow for infotemplate flMCY_Stores_Labels.show(); } else{ //Hide Labels flMCY_Stores_Labels.hide(); } } ); }); map.addLayers([dlDRegionDistrictPolygons,flMCY_Stores_Labels,dlMCY_Stores,flDistricts,flRegions]);
... View more
10-02-2014
04:45 AM
|
0
|
7
|
1577
|
POST
|
This lead me in the right direction. I just created another feature layer with opacity set to 00 and then used that to label. Not the best of solutions but hey it works.
... View more
09-30-2014
05:17 AM
|
0
|
1
|
792
|
POST
|
Hi Sarah and thanks for the quick reply. I've tried messing around with your code and this example: Label Layer | ArcGIS API for JavaScript but for the life of me I can't get it working. I wonder if it is because I am using a graphics layer and not a feature layer? Basically I am filtering out a layer and then presenting the results as graphics. I would then like to have labels for each of the graphics so they know the points name. (StoreName) in this case.
... View more
09-30-2014
04:19 AM
|
0
|
0
|
792
|
POST
|
I have successfully been able to query my results and put them in a table and show them as points on my map thanks to a lot of help from these forums. Now what I would like to do is create another graphics layer that just has labeling for these points but I am struggling with this. I've searched endlessly for a way to do this. I've looked through the samples I've found something called a labellayer but I don't know how to apply that. I would think I would be able to use something like what I did for the graphics below but instead of a symbol use text. I created a StoresResultsLayer_Labels as you can see below. I'm sure this is simple but it is not for me for some reason. Any help is greatly appreciated. //My layers loaded at the start of the application but blank StoresResultsLayer = new GraphicsLayer(); StoresResultsLayer.id = 'StoresResults'; map.addLayer(StoresResultsLayer,0); StoresResultsLayer_Labels = new GraphicsLayer(); StoresResultsLayer_Labels.id = 'StoresResults_Labels'; map.addLayer(StoresResultsLayer_Labels,0); //Some of my code from my function var symbol = new esri.symbol.SimpleMarkerSymbol({ "color": [255,255,0,255], "size": 11, "xoffset": 1, "yoffset": -2, "type": "esriSMS", "style": "esriSMSCircle", "outline": { "color": [0,0,0,255], "width": 3, "type": "esriSLS", "style": "esriSLSSolid" }}); var dataForGrid = []; var temp = ""; //remove all graphics on the maps graphics layer StoresResultsLayer.clear(); //Performance enhancer - assign featureSet array to a single variable. var resultFeatures = featureSet.features; //Loop through each feature returned for (var i=0, il=resultFeatures.length; i<il; i++) { //Get the current feature from the featureSet. //Feature is a graphic var graphic = resultFeatures; resultFeatures.setSymbol(symbol); StoresResultsLayer.add(resultFeatures); StoresResultsLayer.show();
... View more
09-29-2014
07:32 AM
|
0
|
4
|
3059
|
POST
|
1. enhanced "Directions widtget" as in AGOL where it's possible add stops doing an identify on a point then choosing: "Get Directions"; Huge huge fan of this. Doesn't have to be an identify though but on any popup box of a point.
... View more
08-27-2014
05:56 AM
|
0
|
2
|
598
|
POST
|
I like the idea of an interactive filter as well. I thought that was going to be what the query filter was going to do. I thought when it was asking for unique values that it was going to show the users a drop down box to choose what to query by. It would be great if it did a multi select box. So they could select five states to highlight. I also saw the inbetween for value and thought it would allow users to select between two different values. For example select all states where population was between 1,000,000 and 5,000,000. Would be great if it created an inbetween slider And to be super awesome it would be nice if it created its own layer that went into the data grid. This would be the best feature ever!
... View more
08-11-2014
06:27 AM
|
6
|
0
|
1409
|
POST
|
I couldn't find where I could edit my own question so I replied to it 🙂 When I say localized events I mean events such as concerts, ball games, groups coming to town for a convention, festivals etc.
... View more
08-01-2014
04:58 AM
|
0
|
0
|
205
|
POST
|
Does anyone know where I can get localized events to bring into a JavaScript application as a layer? Has anyone been able to do something where they could bring events in and then create a buffer to find say events this weekend in a one mile buffer?
... View more
08-01-2014
04:44 AM
|
0
|
1
|
2231
|
Title | Kudos | Posted |
---|---|---|
1 | 04-18-2014 06:58 AM | |
6 | 08-11-2014 06:27 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|