POST
|
OK. I have found the course of my woes. But that presents another major problem all together! just found out the Legend Widget does not support MapService URL with Tokens at the end for Secured Services... Has anyone got a take on this please. Cheers.
... View more
11-22-2010
01:25 AM
|
0
|
0
|
402
|
POST
|
slight deviation, I hope someone can shed some light on this for me. I have a couple of map services (created using 9.3.1) and I was trying to use the legend widget referencing the 2.1 JS API. This is however not working right. The container to hold the legend displays "Loading Legend..." then after a few seconds says "no legend to display". This might be a daft question but is the legend widget backward compatible? is anyone else experiencing this? Any help would be very much appreciated. Cheers
... View more
11-21-2010
08:57 AM
|
0
|
0
|
402
|
POST
|
I hope this thread is still active.... I have a couple of map services (created using 9.3.1) and I was trying to use the legend widget referencing the 2.1 JS API. This is however not working right. The container to hold the legend displays "Loading Legend..." then after a few seconds says "no legend to display". This might be a daft question but is the legend widget backward compatible? is anyone else experiencing this? Any help would be very much appreciated. Cheers
... View more
11-21-2010
08:50 AM
|
0
|
0
|
218
|
POST
|
Sorted.The cases obviously didn't do the trick. Bizarrely the Map.graphics.clear() worked as expected under an onDrawEnd event! Strange!
... View more
09-21-2010
12:09 AM
|
0
|
0
|
361
|
POST
|
Hi Folks, There's a lot of help on connecting or disconnecting dojo events been through most but I'm still having issues with stopping a map.graphics.clear () event bubbling over. I have tried disconnecting it in several places in the "pan" case as well as tried several approaches but it just wouldn't stop bubbling... any help welcome. cheers
function changeCursor(cursors) {
var clrGrph = dojo.connect(map, "onMouseUp", function(event) { map.graphics.clear(); event.stopPropagation(); });
//dojo.disconnect(clrGrph);
switch (cursors) {
case "pan":
dojo.disconnect(clrGrph);// not responding
alert("you"); //responds
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndopen.cur'),crosshair";
down = dojo.connect(map, "onMouseDown", function(evt) {
dojo.disconnect(clrGrph);// not responding
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndclosed.cur'),crosshair";
});
dojo.connect(map, "onMouseUp", function(evt) {
dojo.disconnect(clrGrph); // not responding
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndopen.cur'),crosshair";
});
break;
case "extract_d":
//dojo.connect(clrGrph);
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/extractData1.cur'),crosshair";
dojo.connect(map, "onMouseDown", function(evt) {
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/extractData1.cur'),crosshair";
});
dojo.connect(map, "onMouseUp", function(evt) {
dojo.connect(clrGrph);
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/extractData1.cur'),crosshair";
});
break;
}
}
... View more
09-16-2010
01:40 PM
|
0
|
1
|
1531
|
POST
|
Hi, If you've not already solved this you can do something like this on your onmousedown event. function changeCursor(cursors) {
switch (cursors) {
case "pan":
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndopen.cur'),crosshair";
down = dojo.connect(map, "onMouseDown", function(evt) {
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndclosed.cur'),crosshair";
});
dojo.connect(map, "onMouseUp", function(evt) {
dojo.byId("Map_Panel_layers").style.cursor = "url('images/cursors/hndopen.cur'),crosshair";
});
//dojo.byId("map_zoom_slider").style.cursor = 'default';
//dojo.byId("map_infowindow").style.cursor = 'default';
//dojo.byId("navToolbar").style.cursor = 'default';
break;
}
}
... View more
09-08-2010
01:01 AM
|
0
|
0
|
252
|
POST
|
Hi Folks, Wondering if anyone can help unmask the error of my ways (code). The results of my identify task are put into a dynamically created table and for every record I have appended a "Zoom To" text which onClick, I want the to zoom to that feature on the map. I'm having two issues which I've spent hours on but can't seem to resolve... 1. in IE7, when my results are displayed and I click on the "Zoom To" on any of the records except the very first record, the app does exactly as expected and zooms into the geometry/feature. However, nothing happens afterwards when i click on any of the other "Zoom To"! 2. Clicking "Zoom To" of the first record results in the error " 'target' is null or not an object ". FF however only zooms to the first and the second record!! And doesn't zoom to any another record. Any help would be very much appreciated //****IDENTIFY - DYNAMIC TABLE AND RESULTS SNIPPET*****// resultSetToTable: function(resultSet, that){
// Receives result array (featureSet) from an Identify Task/Query Task/Find Task and
// returns an array of tables for each layer in the result.
// TODO : Validate input resultSet object.
// collection of objects with feature property, containing attributes.
var result;
if (resultSet.length > 0) {
var featureLayerId, feature;
var resultTableArray = new Array(); // Array to store tables in. One Table for each layer that has identify results.
// Create table elements, these will be cloned later
var tr = document.createElement('tr');
var td = document.createElement('td');
var th = document.createElement('th');
var tHead, tHeadRow, tHeadCell, tBody, tRow, tCell; // Reused when creating each table.
}
else {
// No Data
return null;
}
for (var i = 0, il = resultSet.length; i < il; i++) {
// Loop through each feature in the featureSet.
result = resultSet;
if (resultTableArray[result.layerId] === undefined) {
// No table created for that layer
// Create table object
resultTableArray[result.layerId] = document.createElement('table');
resultTableArray[result.layerId].className = "ImmTS_Default";
// write header to the table
tHead = resultTableArray[result.layerId].appendChild(document.createElement('thead'));
tHeadRow = tHead.appendChild(tr.cloneNode(true));
// Check for geometry
if (result.feature.geometry && that) {
tHeadCell = tHeadRow.appendChild(th.cloneNode(true));
//tHeadCell.appendChild(document.createTextNode(""));
}
for (var attribute in result.feature.attributes) {
if (this.displayField(attribute)) {
tHeadCell = tHeadRow.appendChild(th.cloneNode(true));
tHeadCell.appendChild(document.createTextNode(this.getFieldAlias(result.layerId, attribute)));
}
}
// create table body.
tBody = resultTableArray[result.layerId].appendChild(document.createElement('tbody'));
// Write row
tRow = tBody.appendChild(tr.cloneNode(true));
tRow.id = "Result_" + i;
// Check for geometry
if (result.feature.geometry && that) {
tCell = tRow.appendChild(td.cloneNode(true));
var tAnchor = document.createElement('a');
tAnchor.appendChild(document.createTextNode("Zoom to"));
tAnchor.title = "Zoom to this feature";
tCell.appendChild(tAnchor);
tCell.onclick = jQuery.proxy(function(evt){
var resultID = $(evt.target).closest('tr')[0].id.split('_')[1];// Get parent tr ID.
that.zoomtoGeometry(resultSet[resultID].feature);
}, this);
}
for (var attribute in result.feature.attributes) {
if (this.displayField(attribute)) {
tCell = tRow.appendChild(td.cloneNode(true));
tCell.appendChild(this.getActiveText(result.feature.attributes[attribute]));
}
}
}
else {
// Find table body within table element.
tBody = resultTableArray[result.layerId].getElementsByTagName('tbody')[0];
tRow = tBody.appendChild(tr.cloneNode(true));
// Write row to table
// Geometry
if (result.feature.geometry && that) {
tCell = tRow.appendChild(td.cloneNode(true));
var tAnchor = document.createElement('a');
tAnchor.appendChild(document.createTextNode("Zoom to"));
tAnchor.title = "Zoom to this feature";
tCell.appendChild(tAnchor);
tCell.onclick = jQuery.proxy(function(){
that.zoomtoGeometry(result.feature);
}, this);
}
for (var attribute in result.feature.attributes) {
if (this.displayField(attribute)) {
tCell = tRow.appendChild(td.cloneNode(true));
tCell.appendChild(this.getActiveText(result.feature.attributes[attribute]));
}
}
}
}
return resultTableArray;
//**** ZOOM TO - SNIPPET ****// zoomtoGeometry: function(graphic, graphicLayerName){
var graphicLayer;
var resultGraphic = graphic;
// Create or obtain graphic layer
var graphicLayerID = graphicLayerName || "resultGraphics";
if (this.TEAMGISmap.getLayer(graphicLayerID)) {
graphicLayer = this.TEAMGISmap.getLayer(graphicLayerID);
graphicLayer.clear();
}
else {
graphicLayer = new esri.layers.GraphicsLayer();
graphicLayer.id = graphicLayerID;
this.TEAMGISmap.addLayer(graphicLayer);
}
// Setup Graphic Symbology & Zoom Extent Buffer.
var symbol, buffDist, graphicExtent;
var fillColour = new dojo.Color(dojo.Color.named.yellow);
fillColour.a = 0.55;
switch (resultGraphic.geometry.type) {
case "point":
symbol = new esri.symbol.SimpleMarkerSymbol().setColor(fillColour);
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND);
buffDist = 250;
break;
case "polyline":
symbol = new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color(dojo.Color.named.yellow, 0.55), 4);
buffDist = 1000;
break;
default:
symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 255, 255, 0.35]), 1), fillColour);
buffDist = 1000;
}
resultGraphic.setSymbol(symbol);
graphicLayer.add(resultGraphic);
if (resultGraphic.geometry.type !== "point"
) {
graphicExtent = resultGraphic.geometry.getExtent();
graphicExtent.xmin -= buffDist;
graphicExtent.ymin -= buffDist;
graphicExtent.xmax += buffDist;
graphicExtent.ymax += buffDist;
}
else
{
// Point geometries don't have getExtent method. Create extent with buffdist + xy.
graphicExtent = new esri.geometry.Extent();
graphicExtent.xmin = resultGraphic.geometry.x - buffDist;
graphicExtent.ymin = resultGraphic.geometry.y - buffDist;
graphicExtent.xmax = resultGraphic.geometry.x + buffDist;
graphicExtent.ymax = resultGraphic.geometry.y + buffDist;
graphicExtent.spatialReference = resultGraphic.geometry.spatialReference;
}
this.TEAMGISmap.setExtent(graphicExtent, true);
},
... View more
08-10-2010
02:59 AM
|
0
|
0
|
607
|
POST
|
Ok think I cracked it... The loop was doing exactly as it should... adding whatever it found to my result container... hence the repetition. This here bundles the result for a particular layerID in an array then puts that bundle in the result container afterwards! I know this doesn't quiet show the alias but now I can fit your initial code into in. Thanks for your help. function addToMap(idResults, evt) {
var contentArray= new Array();
var resultLayerId;
//var strContent="";
for (var i in idResults){
resultLayerId = idResults.layerId;
idResults.feature.setInfoTemplate(new esri.InfoTemplate("", "${*}"));
if (contentArray[resultLayerId] === undefined)
{
// write heading for that layer
contentArray[resultLayerId] = "<label style='font-size:14px; text-decoration:underline;'>"+idResults.layerName+"</label> <br/>";
// write record result
contentArray[resultLayerId] += idResults.feature.getContent();
}
else
{
// Heading already written. Append feature details
contentArray[resultLayerId] += idResults.feature.getContent();
}
}
if (contentArray.length === 0) {
document.getElementById('divMiniResults').innerHTML = 'No Data at this location. <br/><br/>';
}
else {
document.getElementById('divMiniResults').innerHTML = contentArray.join('<br />');
}
}
... View more
07-27-2010
01:31 AM
|
0
|
0
|
835
|
POST
|
Thanks Derek, Tried that, still having the repetition. Cheers
... View more
07-20-2010
06:36 AM
|
0
|
0
|
835
|
POST
|
OK, I have re written the/my (addToMap) function... But I have a nagging problem and wondering if I could get some pointers.... From my initial problem this approach gives me what I want. function addToMap(idResults, evt) {
var strContent="";
for(var i in idResults){
if(idResults.layerId===2||idResults.layerId===3)
{
//Header
strContent += "<label style='font-size:14px; text-decoration:underline;'>"+idResults.layerName+"</label> <br/>";
//Attributes
switch(idResults.layerId){
case 2:
strContent += " -- <a href=\"" + idResults.feature.attributes.LANDUSE + "\"target=\"_blank\" >Land Use: " + idResults.feature.attributes.LANDUSE + "</a><br/>";
break;
case 3:
strContent += " -- <a href=\"" + idResults.feature.attributes.Shape + "\"target=\"_blank\" >Shape: " + idResults.feature.attributes.Shape + "</a><br/>";
break;
}
}
}
if (strContent == '') {
document.getElementById('divMiniResults').innerHTML = 'No Data at this location. <br/><br/>';
}
else {
document.getElementById('divMiniResults').innerHTML = strContent;
}
} The problem however is I am getting repeated values (see attached img) being returned on some of the values depending on where I click on the map! Pulled the little hair I've got out but can't seem to locate where the bug is!! Any pointers.
... View more
07-17-2010
09:00 AM
|
0
|
0
|
835
|
POST
|
Thanks ever so much Swingley!! Exactly What I was after!!! I'm still working on this, but perhaps you could help (if it's not a bother) seeing you are well versed in this that I. Reading through what you've provided makes perfect sense. I was however trying expand on it... including it in my code which identifies multiple layers on click but it doesn't want to play ball!! My code is pretty much like ESRI's example http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jssamples_start.htm save I'm not using the infoWindow, but that's cosmetics. Any ideas? Thanks again!!! attached is a section of my code.
... View more
07-10-2010
09:54 AM
|
0
|
0
|
835
|
POST
|
Hi Guys, Is it possible to programmatically obtain the Field_Alias from the REST end point for use with the identify task? This ties in with this post http://forums.arcgis.com/threads/7793-Identify-How-to-show-Alias-filed-instead-of-Field-Name?p=23968&posted=1#post23968 Happy if someone could shed some light on this for me Cheers
... View more
07-08-2010
01:31 PM
|
0
|
0
|
742
|
POST
|
If you use a query task, you get field aliases back with your query result. If you're stuck using identify, can you specify your user-friendly names in your info template? Otherwise, I think you're going to have to send off an additional request to get the layer info from the map service, build a field_name: field_alias object and then use the aliases in your info window content. I don't see a way to access field aliases from an identify result. Maybe someone else knows... Thanks for getting back to me Swingley. I am kind of stuck using identify. We are currently hard coding user-friendly names into our info template. What I'm now trying to achieve is to programmatically display the Alias. Could you provide more info on the requesting for layer info from the map service part of your response? A sample code perhaps? I'm trying to get my head round using this approach (which I think is what you mean?) but it's just not working. http://forums.arcgis.com/threads/3971-HowTo-Get-Field-Names-From-Layer?highlight=layer+alias Any help? Thanks
... View more
07-08-2010
01:23 PM
|
0
|
0
|
835
|
POST
|
Hi, Can anyone shed light on how I could display the Alias field of a layer when using the Identify task? By default it displays the field names. However, I would like to display the Alias as this has got more user friendly naming. Can any help? Cheers
... View more
07-07-2010
11:56 AM
|
0
|
9
|
6025
|
Online Status |
Offline
|
Date Last Visited |
03-21-2023
06:55 PM
|