|
POST
|
Here's an example I posted to the code gallery. It takes a little finesse to get floating panes looking and functioning properly. http://www.arcgis.com/home/item.html?id=cf41ba2f1798462f9386efdd674f36ba When you click the (X) on a floating pane dojo destroys the floating pane; hence the error because the floating pane no long exists. The example shows how to change that. You'll need to create a dock and make the floating pane dockable to said dock. My example hides the dock with css. You can have a visible dock, but there's more dojo and css required to make it look and function right. My experience is users don't like the dock.
... View more
09-23-2012
08:33 AM
|
0
|
0
|
2389
|
|
POST
|
dojo.connect(draw.edittoolbar, 'onActivate', function() { app.map.infoWindow.hide() });
... View more
09-21-2012
07:43 PM
|
0
|
0
|
496
|
|
POST
|
Is it possible to disable the popup while editing a graphic? It's a pain to close the popup every time a graphic is clicked on for geom editing. disableMouseEvents() disables all mouse events on the layer, so editing is disabled as well. Thanks
... View more
09-21-2012
01:00 PM
|
0
|
1
|
847
|
|
POST
|
It was a change in the way the legend widget functions from 2.8 to 3.0+. Here's a forum post in which I faced the same issue: http://forums.arcgis.com/threads/65481-Legend-problems-with-secured-services-when-migrating-to-3.0-3.1
... View more
09-18-2012
04:06 PM
|
0
|
0
|
672
|
|
POST
|
It's hard for me to debug via the forum. Zip your code and post, or private message me with it, so I can run it.
... View more
09-17-2012
01:24 PM
|
0
|
0
|
1273
|
|
POST
|
Create an array for those layers you want in the legend: var app = {
mapParams: {
legendLayers: []
}
} Create the legend as part of the onLoad function: app.legend = new esri.dijit.Legend({ map: app.map, layerInfos: app.mapParams.legendLayers }, 'legend_container'); app.legend.startup(); When you are iterating through the layers, push the layer to the legend array: if (l.legend == true) {
app.mapParams.legendLayers.push({
layer: layer,
title: l.name
})
} The legend will update automatically. It's not necessary to connect to the onLayerAddResult if you use the layer object in the addDynamic function. My addDyanamic and addFeature functions are by far my largest and most complex functions because of the layer object: var layer = new esri.layers.ArcGISDynamicMapServiceLayer(url, { id: l.id, visible: l.visible, opacity: l.opacity }); It allows you to easily build controls, add layer functionality, etc in one shot with overall less code. For example: add the layer to a TOC widget, or set the layer up for use with an identify widget. This approach is also very useful with feature layers, when setting up infoTemplates, widgets in the popup, setting up editing, and such.
... View more
09-17-2012
10:27 AM
|
0
|
0
|
1273
|
|
POST
|
Unfortunately this simple example will place the dynamic layer of your choosing below the svg tag one time only. I tried to add all the graphic layers under one root level object that could be moved up/down with all the other layers in my toc widget, but I couldn't get it to work out. I kept running into more and more issues. I'm sure if I had the resources (like a development team), it could be overcome. Hopefully this helps. If you figure something out let me know. And yes...it looks wrong but it works.
... View more
09-13-2012
05:07 PM
|
0
|
0
|
1394
|
|
POST
|
I assume the buildings are a feature layer and it's MODE_ONDEMAND. You could: 1) create a graphic layer for the labels 2) connect to the feature layer's onUpdateStart() method to clear any existing labels on the label graphic layer 3) connect to the the feature layer's onUpdateEnd(error, info), iterate through the features, and: a) get the center of the feature b) create a POINT on the label graphic layer c) instead of a point symbol, give it a text symbol using the attribute of your choice for the label text You'll probably want to set the label graphic layer's display scales. If you haven't worked with text symbols they can be tricky to format properly. The api reference has the basics but I suggest checking out a text symbol in the DOM for unreferenced variables and functionality. The hazard to this approach is the label will be on top of the polygons and will accept a click over the polygon if the user clicks on the label. If there is no info template, onclick etc associated with the polygon it's not a problem.
... View more
09-13-2012
12:12 PM
|
0
|
0
|
864
|
|
POST
|
Here's the order I load js. <script type="text/javascript" src="token.php"></script>
<script type="text/javascript">var djConfig = { parseOnLoad: true }</script>
<script type="text/javascript" src="http://serverapi or local install"></script>
<script type="text/javascript" src="js/config.js"></script>
<script type="text/javascript" src="js/application/?id=someAppId"></script>
... View more
09-13-2012
07:28 AM
|
0
|
0
|
1273
|
|
POST
|
It might be the comma after dpi name/value pair. There should be no comma after the last name/value pair. Firefox won't object if you add it, but Internet Explorer will trigger an error: 'Expected identifier, string or number'.
... View more
09-13-2012
07:21 AM
|
0
|
0
|
1273
|
|
POST
|
There's a good reason why the graphics layers are on top of dynamic layers...however if you wish to move a dynamic layer above all graphics layers here's the scoop. The layers are in the map node like this:
<div id="map_layers">
<div id="map_dynamic_layer_1"></div> //the layer id = dynamic_layer_1, the map_ is added by the api
<div id="map_dynamic_layer_2"></div>
<div id="map_dynamic_layer_3"></div>
<svg id="map_gc">
<g id="graphics_layer_1"> //the g id = graphics_layer_1, api adds nothing
GRAPHICS HERE
</g>
<g id="graphics_layer_2"></g>
</svg>
</div>
You'll notice that all layers except graphic layers (this includes dynamic, tiles, wms, custom, etc) are divs, while graphic layers are contained in a single svg element. They are rendered top to bottom. When you reorder non-graphic layers with map.reorderLayer(layer, index) the api moves the layer to the index passed, always leaving the svg element on the bottom (rendered last and therefore on top). When passing a graphic layer through map.reorderLayer(layer, index) the layer is moved within the svg element. So the svg (all graphics) is a layer just like the others. Let's say we want "dynamic_layer_1" on top of the graphic layers:
dojo.byId('map_layers').insertBefore( dojo.byId('map_gc'), dojo.byId('map_dynamic_layer_1') );
Done. Now that we know how it's done, let's discuss why you don't want to do it: 1) May cause instability (IE is most vulnerable to this, and let's face it; it's a challenge enough getting the anything to work properly in IE to start with) 2) Will cause erratic panning and zooming occasionally 3) The user will no longer be able to interact with graphics or features (unless you move the layer down first, and the main reason why things are the way they are) 4) You never know what's going to happen if you try to reorder layers using map.reorderLayer(layer, index) should you choose to do some reordering 5) I think of several other issues and there is sure to be more If you are making a nice "story" map with no user interaction with graphics or features this will work ok, but...
... View more
09-12-2012
03:37 PM
|
0
|
0
|
1394
|
|
POST
|
Luci - I left too much proprietary junk in there. Start simple and build from there. js object var layersDynamic = [{ url: 'http://server/ArcGIS/rest/services/Flood/MapServer', token: true, name: 'Flood', id: 'flood', visible: false, opacity: 1, imageFormat: 'png24', dpi: 96, }, { url: 'http://server/ArcGIS/rest/services/MunicipalBoundaries/MapServer', token: true, name: 'Municipal Boundaries', id: 'mboundaries', visible: true, opacity: 1, imageFormat: 'png24', dpi: 96, }]; iteration dojo.forEach(layersDynamic, function(l) { addDynamic(l) }); function function addDynamic(l) { var url; if (l.token == true) { url = l.url + '?token=' + //TOKEN OR TOKEN VARIABLE HERE// } else { url = l.url } var layer = new esri.layers.ArcGISDynamicMapServiceLayer(url, { id: l.id, visible: l.visible, opacity: l.opacity }); layer.setImageFormat(l.imageFormat); //implicitly set - doesn't always work if added to layer object params layer.setDPI(l.dpi); //implicitly set - doesn't always work if added to layer object params var control = '<div id="' + l.id + '_layer_control"><input id="' + l.id + '_control_cb" /> ' + l.name + '<div>'; dojo.place(control, 'toc', 'first'); var checkbox = new dijit.form.CheckBox({ checked: l.visible, onChange: function () { if (layer.visible == true) { layer.hide() } else { layer.show() } } }, l.id + '_control_cb'); map.addLayer(layer); //last } One thing to remember: if the service isn't secured "token" should be set to false; if it is you'll have to provide one.
... View more
09-12-2012
10:35 AM
|
1
|
0
|
2768
|
|
POST
|
1. Create a radio button group. This will allow only one checked at a time. 2. You'll need a function, which in one way or another hides the visible layer and shows the one that was selected. Perhaps something like: func: function(layer) {
map._layers.class.hide();
map._layers.order.hide();
map._layers.family.hide();
eval('map._layers.' + layer + '.show()');
} calling it like so: func('class'); Changing the "layer" for each input respectively. That's just one of many ways in which you can achieve the result. I noticed in your example you didn't give your layers an id. I never let the api assign an id to a layer. If you add an id, it's easy to go to the _layers object to impress change upon a layer. All map layers can be found here.
... View more
09-11-2012
12:10 PM
|
0
|
0
|
555
|
|
POST
|
In my opinion, you are making an unnecessary request and limiting easy enhancement of your application. I've stripped this down so it's simpler. The first file I load in the head is config.js. Here's a config object: var config = {
token: 'some_token',
tools: [
{
name: 'Measure',
widget: 'bowc.widget.Measure',
placeAt: 'new floating pane',
placeControls: ['toolbar','mapContext']
}
],
layersDynamic: [
{
url: 'http://server/ArcGIS/rest/services/Flood/MapServer',
token: true,
name: 'Flood',
id: 'flood',
visible: false,
opacity: 1,
imageFormat: 'png24',
dpi: 96,
legend: true,
parcelLabelControl: false,
subLayerControl: true,
identify: true,
identifyLayers: ['*'],
info: true,
infoHtml: 'This layer displays the FEMA flood zones.'
},
{
url: 'http://server/ArcGIS/rest/services/MunicipalBoundaries/MapServer',
token: true,
name: 'Municipal Boundaries',
id: 'mboundaries',
visible: true,
opacity: 1,
imageFormat: 'png24',
dpi: 96,
legend: true,
parcelLabelControl: false,
subLayerControl: true,
identify: false,
identifyLayers: undefined,
info: true,
infoHtml: 'This layer displays city limits and the urban growth boundary (UGB).'
}
],
layersFeature: [
]
} You'll notice that beyond layers, there is also global objects (the token), and objects used to determine layout and functionality. In fact all my apps are built and controlled by a single base class, which uses the config object for all it's params. Somewhere in my buildUI function it's time to add layers: dojo.forEach(config.layersDynamic, function(l) { app.layers.addDynamic(l) }); Simple iteration of the object. Here's app.layers.addDynamic() var app = {
layers: {
addDynamic: function (l) {
var url;
if (l.token == true) {
url = l.url + '?token=' + token
} else {
url = l.url
}
var layer = new esri.layers.ArcGISDynamicMapServiceLayer(url, {
id: l.id,
visible: l.visible,
opacity: l.opacity
});
layer.setImageFormat(l.imageFormat); //implicitly set - doesn't always work if added to layer object params
layer.setDPI(l.dpi); //implicitly set - doesn't always work if added to layer object params
var control = '<div id="' + l.id + '_layer_control"><input id="' + l.id + '_control_cb" /> ' + l.name + '  <img id="' + l.id + '_update" src="images/updating.gif" style="display:none; width:14px; height:14px;" /><div>'
dojo.place(control, 'toc', 'first');
var checkbox = new dijit.form.CheckBox({
checked: l.visible,
onChange: function () {
if (layer.visible == true) {
layer.hide()
} else {
layer.show()
}
}
}, l.id + '_control_cb');
dojo.connect(layer, 'onUpdateStart', function (evt) {
dojo.style(l.id + '_update', 'display', 'inline')
});
dojo.connect(layer, 'onUpdateEnd', function (evt) {
dojo.style(l.id + '_update', 'display', 'none')
});
if (l.legend == true) {
//add to legend
}
app.map.addLayer(layer); //last
}
}
} Layer added with some extras. Just like yours. So there's one approach which may help.
... View more
09-11-2012
11:37 AM
|
0
|
0
|
2768
|
|
POST
|
Is the json generated, e.g. asp, php, etc; or is it a file?
... View more
09-11-2012
09:06 AM
|
0
|
0
|
2768
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-18-2013 06:56 AM | |
| 1 | 06-30-2015 09:17 AM | |
| 1 | 10-12-2013 07:14 AM | |
| 1 | 02-05-2014 11:05 AM | |
| 1 | 05-28-2015 11:41 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|