|
POST
|
Have you taken a look at nliu's Table of Contents widget?
... View more
04-09-2013
06:09 AM
|
0
|
0
|
1276
|
|
POST
|
Thanks Leo! The code I provided yesterday will allow the user to change the stations and the years and get a new list.
... View more
04-09-2013
05:37 AM
|
0
|
0
|
2086
|
|
POST
|
This was the code I tested in an ArcGIS VBA project which worked correctly. Did you notice the change in the line Dim myArray() Can't do the years like that because Urban only has the years of 2010, 2011, and 2012. This was the code you originally had in your attached text file which populated the years from 2010 through 2015.
... View more
04-08-2013
01:07 PM
|
0
|
0
|
1877
|
|
POST
|
I'm using nliu's TOC script and am playing the example script (I'm just making the transition to JavaScript from Flex). Some of my layers can be complex and take a little while to actually appear on the map, so I'd like to show a wait cursor until the layer is ready. I'm using the onUpdateStart and onUpdateEnd to change the cursor, but this is only appearing when the cursor is in the TOC div. If I move the cursor to the map div, the cursor changes to the default cursor. How do I make the wait cursor show in both divs? Here's the coding I'm using <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" /> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" /> <title>TOC</title> <!--<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css">--> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/js/esri/css/esri.css"> <link rel="Stylesheet" type="text/css" href="css/style.css" /> <style> html, body { height: 98%; width: 98%; margin: 0; padding: 5px; font-family: helvetica, arial, sans-serif; font-size: 90%; } #leftPane { width: 280px; overflow: auto; } /* this line hide layers when out of scale for the inline TOC */ #scaleDiv .agsTOCOutOfScale { display: none; } </style> <script type="text/javascript"> var djConfig = { parseOnLoad: true, packages: [{ "name": "agsjs", "location": location.pathname.replace(/\/[^/]+$/, "") + '/agsjs' // "location": location.pathname.replace(/\/[^/]+$/, "")+'/../build/agsjs' //"location": 'http://gmaps-utility-gis.googlecode.com/svn/tags/agsjs/2.02/xbuild/agsjs' // for xdomain load }] }; </script> <!--<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0">--> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.4/"></script> </script> <script type="text/javascript"> // //dojo.require("dijit.dijit"); dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); // uncomment if want dojo widget style checkbox //dojo.require('dijit.form.CheckBox'); dojo.require("esri.map"); dojo.require("dijit.layout.AccordionContainer"); dojo.require("dojo.fx"); // needed if use jsapi 3.0 dojo.require("agsjs.dijit.TOC"); </script> <script type="text/javascript"> var map; function init() { map = new esri.Map("map", { showAttribution: false }); //Add the terrain service to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"); map.addLayer(basemap); var layerSEFCRI = new esri.layers.ArcGISDynamicMapServiceLayer("http://egisws02.nos.noaa.gov/ArcGIS/rest/services/biogeo/SEFCRI/MapServer", { id: 'SEFCRI' }); dojo.connect(map, 'onLayersAddResult', function (results) { var toc = new agsjs.dijit.TOC({ map: map, layerInfos: [{ layer: layerSEFCRI, title: "SEFCRI", slider: true }] }, 'tocDiv'); toc.startup(); layerSEFCRI.setVisibleLayers([0]); }); map.addLayers([layerSEFCRI]); document.body.style.cursor = "wait"; dojo.connect(layerSEFCRI, "onLoad", function () { map.setExtent(layerSEFCRI.initialExtent, true); document.body.style.cursor = "default"; }); dojo.connect(layerSEFCRI, "onUpdateStart", function () { document.body.style.cursor = "wait"; }); dojo.connect(layerSEFCRI, "onUpdateEnd", function (error) { document.body.style.cursor = "default"; if (error) { alert("Updated completed with error: " & error); } }); //resize the map when the browser resizes - view the 'Resizing and repositioning the map' section in //the following help topic for more details http://help.esri.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_guidelines.htm var resizeTimer; dojo.connect(map, 'onLoad', function (theMap) { dojo.connect(dijit.byId('map'), 'resize', function () { //resize the map if the div is resized clearTimeout(resizeTimer); resizeTimer = setTimeout(function () { map.resize(); map.reposition(); }, 500); }); }); } dojo.addOnLoad(init); </script> </head> <body class="claro"> <div id="content" dojotype="dijit.layout.BorderContainer" design="headline" gutters="true" style="width: 100%; height: 100%; margin: 0;"> <!-- <div id="header" dojotype="dijit.layout.ContentPane" region="top"> <div> <b>Table Of Content (TOC/Legend) Widget</b> <a style="right:20px;position: absolute" href="../docs/toc/examples.html">Documentation</a> </div> <ul style="margin:2px"> <li> Click check box to turn on/off layers. When click on groups, all sublayers will be turned on/off. </li> </ul> </div>--> <div dojotype="dijit.layout.ContentPane" id="leftPane" region="left" splitter="true"> <div id="tocDiv"> </div> </div> <div id="map" dojotype="dijit.layout.ContentPane" region="center"> </div> </div> </body> </html>
... View more
04-08-2013
12:48 PM
|
0
|
1
|
3130
|
|
POST
|
Try this. This will change the values of your districts if you select a new year or a new station. Private Sub UserForm_Initialize() Dim x As Integer For x = 2010 To 2015 cboYear.AddItem x Next cboStations.AddItem "Annual" cboStations.AddItem "Urban" End Sub Private Sub cboStations_Change() If cboYear.Value <> "" Then UpdateDistrict End If End Sub Private Sub cboYear_Change() If cboStations.Value <> "" Then UpdateDistrict End If End Sub Private Sub UpdateDistrict() Dim myArray() Dim myElement As Variant cboDistrict.Clear myArray = Array() If cboStations.Text = "Annual" Then If cboYear.Text = "2010" Or cboYear.Text = "2011" Or cboYear.Text = "2012" Then myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2011" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2012" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2012" Then ' myArray = Array("Abilene", "Amarillo", "Atlanta", "Austin", "Beaumont", "Brownwood", "Bryan", "Childress", "Corpus_Christi", "Dallas", "El_Paso", "Fort_Worth", "Houston", "Laredo", "Lubbock", "Lufkin", "Odessa", "Paris", "Pharr", "San Angelo", "San_Antonio", "Tyler", "Waco", "Wichita_Falls", "Yoakum") ' ElseIf cboYear.Text = "2013" Then ' myArray = Array() ' ElseIf cboYear.Text = "2014" Then ' myArray = Array() End If ElseIf cboStations.Text = "Urban" Then If cboYear.Text = "2010" Then myArray = Array("Abilene", "Amarillo", "Austin", "San_Antonio", "Waco", "Wichita_Falls") ElseIf cboYear.Text = "2011" Then myArray = Array("Beaumont", "Houston") ElseIf cboYear.Text = "2012" Then 'or just Else myArray = Array("Brownwood", "Bryan", "Childress", "Corpus_Christi", "El_Paso", "Lubbock", "Odessa", "Yoakum") ' ElseIf cboYear.Text = "2013" Then ' myArray = Array() ' ElseIf cboYear.Text = "2014" Then ' myArray = Array() End If End If For Each myElement In myArray cboDistrict.AddItem myElement Next End Sub
... View more
04-08-2013
11:43 AM
|
1
|
0
|
4279
|
|
POST
|
I left out one statement
dim myArray() as String
dim myElement as Variant
cboDistrict.Clear
If cboStations.Text = "Urban" Then
etc.
End If
For Each myElement in myArray
cboDistrict.AddItem myElement
Next
... View more
04-08-2013
05:04 AM
|
0
|
0
|
1877
|
|
POST
|
What line are you getting this on? Also it looks like you want to combine the two If statements. If you are using both arrays to populate cboDistrict (you left off that code) then only use one array.
If cboStations.Text = "Annual" Then
myArray = Array("Abilene", ...
Else If cboStations.Text = "Urban" Then ' or just Else If if you won't have additional stations
If cboYear.Text = "2010" Then
myArray = Array("Abilene", ...
etc
End If
For Each myElement in myArray
cboDistrict.AddItem myElement
Next
... View more
04-05-2013
09:59 AM
|
0
|
0
|
2402
|
|
POST
|
This code would go into the cboYear_Change sub. In the cboStations_Change sub, I would image you'd have this code
cboYear.Clear
If cboStations.Text = "Urban" Then
cboYear.AddItem "2010"
cboYear.AddItem "2011"
cboYear.AddItem "2012"
Elseif cboStations.Text = "Rural" Then
cboYear.AddItem "2011"
End If
... View more
04-05-2013
08:37 AM
|
0
|
0
|
2402
|
|
POST
|
The easiest thing would be to move cboDistrict.Clear out of the loop altogether. However, your syntax is incorrect for the decisions. The If loop will first evaluate what is selected in the cboStations control. If that is "Urban" it will add in the years then exit from the loop. It will never try to evaluate what has been selected in the cboYear control (and you don't have the line cboDistrict.Clear in that first evaluation). You mistakenly put a / in the first CODE block. If you remove that, it will make it easier to read.
... View more
04-05-2013
07:42 AM
|
0
|
0
|
2402
|
|
POST
|
Based on your question over on GIS.StackExchange and some of your previous questions, you could do something like this
Private Sub cboYear_Change()
dim myArray() as String
cboDistrict.Clear
If cboStations.Text = "Urban" Then
If cboYear.Text = "2010" Then
myArray = Array ("Abilene", "Amarillo", "Austin", "San_Antonio", "Waco", "Wichita_Falls" )
Elseif cboYear.Text = "2011" Then
myArray = Array ("Beaumont", "Houston")
Elseif cboYear.Text = "2012" Then 'or just Else
myArray = Array ("Brownwood", "Bryan", "Childress", "Corpus_Christi", "El_Paso", Lubbock, "Odessa", "Yoakum")
End If
Elseif cboStations.Text = "Rural"
If cboYear.Text = "2010" Then
myArray = Array ("Abilene", "Waco", "Wichita_Falls" )
Elseif cboYear.Text = "2011" Then
myArray = Array ("Beaumont")
Elseif cboYear.Text = "2012" Then 'or just Else
myArray = Array ("Brownwood", Lubbock, "Odessa", "Yoakum")
End If
End If
For Each myElement in myArray
cboDistrict.AddItem myElement
Next
End Sub
... View more
04-05-2013
06:01 AM
|
1
|
0
|
2402
|
|
POST
|
You have to manually set the LODs for the tiled map service. Here's an example on how to do that.
... View more
04-04-2013
01:19 PM
|
0
|
0
|
1308
|
|
POST
|
On Monday, these links weren't working. On Tuesday, they were working again. Now on Wednesday, they're not working again.
... View more
04-03-2013
07:21 AM
|
0
|
0
|
711
|
|
POST
|
Some of the samples on the Samples page are pointing to bad links. For example, in the Data Access section, all of the links in the table of contents except the Gas Price don't work. However, the links in the window on the right are correct. The TOC links have the wrong case: http://developers.arcgis.com/en/javascript/jssamples/data_requestjsonp.html (bad) http://developers.arcgis.com/en/javascript/jssamples/data_requestJsonp.html (good) Also, there is no way to report this, since the Feedback link doesn't appear in the new format
... View more
04-01-2013
12:26 PM
|
0
|
1
|
1071
|
|
POST
|
You should click the check mark on her post to signify it answered your question.
... View more
03-25-2013
12:09 PM
|
0
|
0
|
1293
|
|
POST
|
You should note that the Hybrid layer is out of date. This note is in the map service. This map is in Extended Support and is no longer updated. Esri recommends that you use World_Imagery instead (ArcGIS 9.3 or higher is required). Virtually all of the Esri base maps have been moved to the 102100 projection to match them with the existing Google/Bing maps, so it might be difficult to find a street basemap with the old 4326 projection. Can your wms layer be updated to the 102100 projection?
... View more
03-21-2013
11:23 AM
|
0
|
0
|
1995
|
| 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 |
yesterday
|