|
POST
|
Dorothea - just a thought I had this morning. Have you the ability to test in both Chrome and IE7 or IE8? If so, then is there any difference in speed? If there is a speed difference (and I'd hope Chrome would be faster) then it will be down to some JavaScript issue, as Chrome is so much faster than IE7/8. If there isn't much time difference, then the issue, as you suspect, is the time the server is spent processing the request. Cheers ACM
... View more
09-10-2012
12:14 AM
|
0
|
0
|
1665
|
|
POST
|
updated file and CSS - revised screen shot showing alternating styles [ATTACH=CONFIG]17547[/ATTACH]
... View more
09-07-2012
05:55 AM
|
0
|
0
|
1665
|
|
POST
|
Dorothea Here's my code. Hopefully I've not missed anything from it. Like you I will be having many layers. Our current ArcIMS internal system has about 50 feature layers and about 12 raster layers. Obviously not all on at once, but adding a layer in ArcIMS is a task, so I wanted to simplify it for my replacement. If you require the feature I've added to use the MXD layer description to power a hyperlink, then you need to add this to your init function dojo.connect(dynamicMapServiceLayer, "onLoad", function () { var content = ""
//return the layer descriptions into an array - we use this later for the info dialog to generate hyperlinks
dojo.forEach(dynamicMapServiceLayer.layerInfos, function (layer) {
var restAPIServicePage = {
url: mapservice2 + "/" + layer.id + "?f=json",
callbackParamName: "callback",
load: function (data) {
LayerDescriptions[layer.id] = data.description;
}
};
dojo.io.script.get(restAPIServicePage);
})
}); I can't claim credit for that - see this post on the old forums. You'll also need a few "var"s at the start of your code var LayerDescriptions = []
(maybe more, but you'll need to work them out) Then reference the attached file (renamed with .js extension) If you want to use the hyperlink feature then add, to your description a valid, full URL, including parameter, but surround where you want the value of a field with the field alias (see earlier post for example) Hopefully that'll all work - it is still a bit rough - as it stands it will fail if one layer name is a substring of another "So if you have a layer called "Wards" and another "County Wards" it will get confused,but the bit where it checks if the result is in a new layer or not can easily be re-written to use layer ID. The one other suggestion to improving return speed is to look at your data. Is it all in an SDE? If any shapefiles then have they got good spatial indexes? Do you have any very large polygons that get returned a lot? I had this issue on one of my maps, one polygon covering most of our district. Returning the geometry of this took about the time you have got. So for just that one feature I created a duplicate polygon with simplified features (if you haven't got ArcINFO license, you haven't got this feature , but QGIS can do it for free) - this layer was added to a different service, which was used purely for the ID task. A bit of a bodge but worked. Have fun ACM PS Just looked at the file - the test and create popup function are not needed, and looking at my screen shot I realize I haven't got the code working that alternates the row format - but I'm sure that that is a quick fix, moving my row counter increment. - I'll add any new version, plus my CSS sometime later, when I've got it working
... View more
09-07-2012
12:32 AM
|
0
|
0
|
3137
|
|
POST
|
Hi You may be interested in the code I just finished - basically doing away with tabs and re-creating the old ArcIMS html viewer look - see screen shot [ATTACH=CONFIG]17513[/ATTACH] My code does away with any hard coding in the script. It takes ALL exposed fields and displays them (although not system fields like shape, ID etc), using their aliases, as defined in the MXD. Also, it looks at the sublayer description to see if you want a specific field to act as contents in a hyperlink - so adding "http://www.eastdevon.gov.uk/my_neighbourhood?uprn=£UPRN£" in to the description will substitute the value of the UPRN filed for the string £UPRN£ (£ chosen as a delimiter as it is never used in javascript) Reply here if you want the code - still a bit rough around the edges. Also, unless you really NEED the geometry, you can speed things up with returnGeometry = false or by simplifying what is returned by increasing the maxAllowableOffset (see http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/identifyparameters.htm). Cheers ACM
... View more
09-06-2012
01:00 AM
|
0
|
0
|
3137
|
|
POST
|
Resolved adding "autofocus:false" to the creation code works.
... View more
09-04-2012
01:23 AM
|
0
|
0
|
698
|
|
POST
|
Hi I have some code that uses an identify task. In the idenfify task execute function, I loop through the layers found and the fields found to build up a set of tables (one per layer) containing all the field aliases and values - basically recreating the ArcIMS html viewer Identify All results. I pop these up in a dojo dialog box. The box is defined by CSS as a specific percentage - .dijitDialog{ max-height: 50%; max-width:50%; overflow: auto; } this works fine for a few results, but when I have a fair few results, the vertical scroll bar appears - but the initial position is half way down the document. I'm not sure if this is something I've missed or an issue with dojo itself. Cheers ACM
... View more
09-03-2012
01:21 PM
|
0
|
1
|
2107
|
|
POST
|
As you say, awesome! Many thanks for pointing that out PS for others to working check this, I've added the code to my personal website http://chawke.co.uk/graphic_symbology.html PPS Some tweaking is needed for the latest versions, any version of the API over 2.0 breaks the layout, plus as discussed elsewhere the references to 'esri' needs moving to the end of the init function pps Not much needed for 3.1 API - just the moving the few references to the init function and making sure the CSS was pointed to 3.1 as well 😮 which I forgot the first time http://chawke.co.uk/g3.html for tweaked version for latest API
... View more
08-10-2012
10:54 PM
|
0
|
0
|
1492
|
|
POST
|
Yay! that's the sort of thing, many thanks. Any worked example of adding text? Although I'm sure I can work that one out, an additional menu item, and maybe an additional drop down (or two for font size and font) PS - I'll explore the local storage route for all sorts of options as soon as I get a date for our XP >> Windows 7 roll out - at the moment I am limited to a user base with IE8
... View more
08-09-2012
10:23 PM
|
0
|
0
|
1492
|
|
POST
|
Not really - it was adapting these examples http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_draw.html and http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_edit.html to allow users to change the style of the things they are drawing - the current redlining tool in ArcIMS allows them to define the style as they are drawing, but not to change it afterwards - so that is my baseline to achieve - my goal is to allow them to edit a set of layers (point, line, polygon, annotation) which then gets stamped with their AD name and filtered when it is displayed so only they can see it. I probably will have attributes that define the style - so a field called "Colour" and a pick list of a dozen or so. For the my users that'll be enough, it isn't a massively used feature, but one they will moan about if I replace the old ArcIMS tool with a new one. Cheers ACM
... View more
08-09-2012
01:02 PM
|
0
|
0
|
1492
|
|
POST
|
Hi I can see how using the draw and edit toolbars I can allow my users to add their own stuff on a temporary basis, but is there any easy way yet to allow them to change the symbology of an individual item - plus to be able to add text? THey have been used to using the ArcIMS Redlining tool (http://arcscripts.esri.com/details.asp?dbid=14276) so my current project to move away from ArcIMS depends on being able to give them what they currently have. Cheers ACM
... View more
08-09-2012
01:15 AM
|
0
|
6
|
2284
|
|
POST
|
In case anyone else ins interested I worked it out - I have an array that contains the names of my default sub-layers, called defaultlayers, it is a global variable I then altered this part of the TOC.js
_createRootLayerTOC: function () {
var b = this.rootLayer;
if (!b._tocInfos) {
var c = {};
dojo.forEach(b.layerInfos, function (d) {
c["" + d.id] = d;
console.debug(d)
if (contains(defaultlayers,d.name)) {
d.visible = true;
}
else {
d.visible = false;
}
..... Cheers ACM
... View more
07-23-2012
01:59 AM
|
0
|
0
|
3863
|
|
POST
|
Hi Seeing this thread made me have another go at this TOC - last time I was still learning about the JSAPI I have a code base that I use for many pages that all share the same main dynamic map service - the main page calls the script and passes an array of default visible layers, this is then test for in my code and actioned -
function defaultvis(layer) {
visible = [];
var items = dojo.map(layer.layerInfos, function (info, index) {
if (contains(defaultlayers, info.name)) {
visible.push(info.id);
console.debug(info.name + "ative")
} else {
console.debug(info.name)
}
});
dynamicMapServiceLayer.setVisibleLayers(visible);
}
This works fine, but of course the TOC code doesn't pick up on the changed visibility and shows all layers unticked (the default state) Any ideas how I should call a refresh or something of the TOC to get the boxes ticked? Many thanks to the writer for a really nice TOC - it functions just as stated. Cheers ACM
... View more
07-20-2012
06:42 AM
|
0
|
0
|
3863
|
|
POST
|
It looks like you should be able just to add identifyParams.layerIds = visible to function executeIdentifyTask(evt) {
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent; to give you function executeIdentifyTask(evt) {
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
identifyParams.layerIds = visible Should work
... View more
07-17-2012
11:05 PM
|
0
|
0
|
6826
|
|
POST
|
Hi I thought I'd give something back for a change and couldn't see anything like this already posted. I wanted to use the popup widget as demonstrated on this sample. But use it so that the layer/field definitions were generated from the map service, in order to cut out hard coding changes, so if a new layer or field are added all that needs to be done is to ensure the alias is set in the MXD. Hacking around a few other samples and I ended up with this.
function executeIdentifyTask(evt) {
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function (response) {
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function (result) {
var feature = result.feature;
var infotext;
var rowc = 0;
infotext = "<table width=99% class='popuptable'>";
infotext += "<tr><th colspan='2' scope='col'>" + result.layerName + "</th></tr>";
for (j in result.feature.attributes) {
var template = new esri.InfoTemplate("", result.feature.attributes );
if (isEven(rowc)) {rowstyle='idlineeven'}
else{
rowstyle='idlineodd'
}
console.debug(result)
if (j.toUpperCase() != "OBJECTID" && j.toUpperCase() != "SHAPE" && j.toUpperCase() != "SHAPE_AREA" && j.toUpperCase() != "SHAPE_LENGTH") {
infotext += "<tr class='" + rowstyle + "'><th>" + j + ": </strong><td>";
infotext += result.feature.attributes + "</td></tr>" ;
rowc = rowc +1
}
}
infotext += "</table>"
var template = new esri.InfoTemplate("", infotext);
feature.setInfoTemplate(template);
map.infoWindow.resize(400, 200);
return feature;
});
});
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
}
I also needed a "Is a number odd or even function"
function isEven(value)
{
return /^\d+$/.test(value.toString()) ? (value%2 === 0 ? true : false ) : false;
}; In order to style the output nicely using basic CSS
.idlineeven {
background-color:#F30
}
.idlineodd {
background-color:#3C0
}
.popuptable{text-align:left}
Working example on my personal site Any comments or suggestions for improvement or areas where I've used bad practice would be welcome. As it mainly was a cut and paste job from various other examples I have no idea really how it works, it just does, 😄 Cheers ACM
... View more
07-16-2012
05:02 AM
|
0
|
0
|
781
|
|
POST
|
I had the same issue and resolved it like this. I use this function from one of the samples
function updateLayerVisibility() {
var inputs = dojo.query(".list_item"), input;
visible = [];
dojo.forEach(inputs,function(input){
if (input.checked) {
visible.push(input.id);
}
});
//if there aren't any layers visible set the array to be -1
if(visible.length === 0){
visible.push(-1);
}
dynamicMapServiceLayer.setVisibleLayers(visible);
}
I then added identifyParams.layerIds = visible In the relevant place and it all worked! I was quite surprised ACM
... View more
07-13-2012
06:53 AM
|
0
|
0
|
3286
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-28-2025 01:14 AM | |
| 1 | 12-01-2023 06:07 AM | |
| 2 | 11-29-2024 04:32 AM | |
| 1 | 05-28-2024 12:50 AM | |
| 1 | 03-16-2023 06:46 AM |
| Online Status |
Offline
|
| Date Last Visited |
14 hours ago
|