|
POST
|
This is not true�?? while IE7 doesn't support most of the technologies commonly referred to as "HTML5", the simple doctype works for IE7. For example, see our sample that shows new query functionality at 10.1: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_statistics.html That sample uses the simple doctype and works w/o issue in IE7. As Kelly pointed out, the real issue is the trailing comma. Be especially carefully with trailing commas in JSON. It will break IE every time. I highly recommend a json validator like http://jsonformatter.curiousconcept.com/
... View more
04-11-2012
12:28 PM
|
0
|
0
|
1813
|
|
POST
|
Let me 'splain. [pause] No, there is too much. Let me sum up. Ok so we are using a highly modified version of the JSViewer sample from many moons ago, accessing Local GIS Server services from multiple servers, one that is secured using tokens (arcgis server 10sp4 for JAVA). We access these services twice. Once for the mapLayer, Once directly to the legend for a TOC icon. The application is deployed as a war file on tomcat, all services, application, and locally hosted API accessed via a WebApp Firewall (modproxy) to avoid cross-domain issues. On upgrading from 2.5 to 2.6, i had to add to my index.jsp function initSecurity() {
// Comment out these lines, and the onresize on body
// if you don't want full-screen
var serverInfo = new esri.ServerInfo();
serverInfo.server = 'https://www.mymanatee.org';
serverInfo.tokenServiceUrl = 'https://www.mymanatee.org/arcgis/tokens/generateToken';
esri.id.registerServers([serverInfo]);
};
if(document.location.protocol==="https:"){
dojo.addOnLoad(initSecurity);
}
for the services, and then for the TOC add var params = {
url:urls+"/legend",
layerName:layerNames,
content:{f:"json"},
handleAs: "json",
sync: true,
load: dojo.hitch(this, "onLegendLoad"),
error: dojo.hitch(this, "onLegendError")
};
if(document.location.protocol==="https:"){
if(esri.id.credentials.length>0){
params.content["token"]=esri.id.credentials[0].token;
}
} which allows me to add the token to the url call for the legend json. This worked upgrading from 2.5 to 2.6 (it was not necessary at 2.5 as the token server was guessed) however it seems to be broken at 2.7/2.8 resulting in an uninitialized variable for me. Simply changing back to 2.6 gets rid of the error The onLegendLoad function onLegendLoad: function(response, ioArgs) {
var minScale=591657527.591555;
var maxScale=0;
if(!this.tocScales[ioArgs.args.layerName]){
this.tocScales[ioArgs.args.layerName]={response:response, ioArgs:ioArgs};
}
dojo.forEach(response.layers, dojo.hitch(this,function(layer){
dojo.forEach(layer.legend, dojo.hitch(this, function(legend){
var legendUrl= legend.url;
if(legendUrl.length<10){
legend.url = ioArgs.url.replace("legend?f=json&token=",layer.layerId+"/images/"+legendUrl+".png?token=");
legend.url = ioArgs.url.replace("legend?f=json",layer.layerId+"/images/"+legendUrl+".png");
}
minScale=layer.minScale;
maxScale=layer.maxScale;
if(minScale==0){
minScale=591657527.591555;
}
if((minScale==0&&maxScale<=1)||(this.currentScale>maxScale&&this.currentScale<minScale)){
layer.scaleVisible=true;
}else{
layer.scaleVisible=false;
}
}))
}))
this.layersInfoLegend.push(response.layers);
}, Does two things, it loops through every service and every sublayer, and grabs the legend icon. This is where the token needed to be appended for the secure services It also checks the scale dependency of the service to color code the TOC entry to show scale dependent visibility. Of course there are alot of other functions involved, but these are the only two that address security. The version of my site (by config file) that does not access any secure layers (http only) throws no errors and works perfectly at 2.8
... View more
04-11-2012
12:06 PM
|
0
|
0
|
2049
|
|
POST
|
Did this change again with 2.7 or 2.8? I had to roll back to 2.6 .
... View more
04-11-2012
10:12 AM
|
0
|
0
|
2049
|
|
POST
|
If your reseller is not sure, you need a new reseller. Contact esri directly if you have to. I am not sure if a commercial organization offering a free product qualifies as non-commercial, you will definitely need a formal answer from ESRI.
... View more
04-11-2012
08:09 AM
|
0
|
0
|
1060
|
|
POST
|
Jeff should absolutely get credit for answering this thread...I just piggy-backed on what he was saying :). I was just teasing Derek. Thats why I love these forums, lots of people working together to help each other. It is a pleasure to be part of this community.
... View more
04-11-2012
04:56 AM
|
0
|
0
|
2685
|
|
POST
|
you will need a "this" somewhere, because you are removing the graphic from the map. In my sample I use dojo.hitch to explicitly hitch the new function(g) into the larger scope (this) so that i have access to this.map In derek's sample, he more eloquently realizes that dojo.forEach can take scope as a third argument, so his code becomes dojo.forEach(graphic, function, scope) - which is the "this" at the end, allowing him to skip the hitch statement. Both have the same effect The only way you could completely avoid using this would be to pass your map object into your function. I dont think that would be very efficient.
... View more
04-10-2012
04:50 AM
|
0
|
0
|
2685
|
|
POST
|
wait so i post the code and derek gets credit for the answer ?? not cool derek, not cool. 🙂 😞
... View more
04-10-2012
04:27 AM
|
0
|
0
|
2685
|
|
POST
|
Yes sorry you dont need the "this" my code was from within a widget we load, so it was for scoping. Glad i helped!
... View more
04-10-2012
04:25 AM
|
0
|
0
|
2685
|
|
POST
|
I do this in kind of a round about way. ON creation I add an ID to the graphic. this.highlightGraphic=new esri.Graphic(geometry, sym);
this.highlightGraphic.id="highlight";
this.map.graphics.add(this.highlightGraphic); Then you can dojo.forEach(this.map.graphics.graphics, dojo.hitch(this, function (g){
if(g&&g.id==="highlight"){
//remove graphic with specific id
this.map.graphics.remove(g);
}
})); does that help? as many have read by now, I've got a data grid populated by a spatial query, and corresponding points in a map (red circles). when you click on a record in the table, I would like a graphic added to the map to highlight (green circle) an already existing point(red circle). when you click a different record in the grid, i would like the first highlighter to disappear, and a new one appear. right now, things go 2 ways, either the selected point never clears, and it adds more and more graphic points, or the last of the red query point graphics to be drawn disappears. how do i specifically remove a graphic from selectedRepGraphic, not just the last graphic added, which is what happens now?
function onRowClickHandler(evt){
var clickedRep = grid.getItem(evt.rowIndex).rep_no;
var selectedRep;
var selectedRepSymbol = new esri.symbol.SimpleMarkerSymbol();
selectedRepSymbol.style = esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE;
selectedRepSymbol.setSize(10);
selectedRepSymbol.setColor(new dojo.Color([0,255,0, 1]));
dojo.forEach(map.graphics.graphics,function(graphic){
if((graphic.attributes) && graphic.attributes.rep_no === clickedRep){
selectedRep = graphic;
var selectedRepGraphic = new esri.Graphic(selectedRep, selectedRepSymbol);
selectedRepGraphic.setSymbol(selectedRepSymbol);
var selInfoTemplate = new esri.InfoTemplate("Sales Rep: ${NAME}", ("${*}")); //"Rep # : ${rep_no}", "Address : ${ADDR1}");
map.infoWindow.setTitle(selectedRepGraphic.getContent("${NAME}"));
map.infoWindow.setContent(selectedRepGraphic.getContent("Sales Rep: ${NAME}", "Rep #: ${rep_no}", "Address : ${ADDR1}"));
selectedRepGraphic.setInfoTemplate(selInfoTemplate);
map.infoWindow.show(selectedRepGraphic.geometry);
if (selectedRepGraphic != undefined){
map.graphics.remove(map.graphics.graphics[map.graphics.graphics.length - 1]);
};
map.graphics.add(selectedRepGraphic);
return;
};
});
return;
};
... View more
04-09-2012
12:33 PM
|
0
|
0
|
2685
|
|
POST
|
Very odd. I have many layers like that, but not in a feature layer, at 2.7 (2.8 NOT AVAILABLE LOCAL YET)
... View more
04-09-2012
10:00 AM
|
0
|
0
|
3213
|
|
POST
|
I am guessing your props layer is poly's with null fill. I wonder if that is causing the bug. Try going to the Legend of the rest service directly and see if you get the error in firebug. In firebug, I get this error when I zoom to the visibility scale of the 'props' layer: exception in animation handler for: onEnd...?v=2.8 (line 14)
TypeError: _69.color is Null...Legend.xd.js (line 19) If I remove the props layer from both the map and legend objects, the error is gone. Here's what I have: dojo.addOnLoad(init);
var mapLayers = [];
var legendLayers = [];
//Function to initialize the map and read data from Configuration file
function init() {
setupFindTask();
//asp.net proxy page for token service
esri.config.defaults.io.proxyUrl = "proxy.ashx";
//change the location of the map slider
esri.config.defaults.map.slider = { left:"13px", top:"76px", width:null, height:"150px" };
//change zoom options to try and get map to display faster
esri.config.defaults.map.zoomRate = 50;
esri.config.defaults.map.zoomDuration = 1000;
dojo.connect(map, "onLoad", mapLoaded);
dojo.connect(grid1, "onRowClick", onRowClickHandler);
//lets grab the details from the config.txt file
dojo.xhrGet({
url: "Config.txt",
handleAs: "json",
preventCache: true,
load: function (responseObject, ioArgs) {
var mapExtent = responseObject.DefaultExtent;
defaultID = responseObject.defaultID;
defaultFacName = responseObject.defaultFacName;
defaultFacCityState = responseObject.defaultFacCityState;
var startExtent = new esri.geometry.Extent(parseFloat(zoomExtent[0]), parseFloat(zoomExtent[1]),
parseFloat(zoomExtent[2]), parseFloat(zoomExtent[3]), new esri.SpatialReference({ wkid: 102100}));
dojo.byId('imgApp').src = responseObject.ApplicationImage;
dojo.byId('lblAppName').innerHTML = responseObject.ApplicationName;
map = new esri.Map("map", { extent: startExtent});
createBasemapGallery();
dojo.connect(map, "onLoad", MapInitFunction);
}
});
}
//map layers can be added here
function MapInitFunction(map) {
var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'facils',
outFields:["*"]
});
legendLayers.push({layer:facils,title:"Facilities"});
var bndry = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/3",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'bndry',
opacity: 0.7,
outFields:["*"]
});
legendLayers.push({layer:bndry,title:"Boundary"});
var props = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/2",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'props',
outFields:["*"]
});
legendLayers.push({layer:props,title:"Property Boundaries"});
dojo.connect(map,'onLayersAddResult',function(results){
var legend = new esri.dijit.Legend({
map:map,
layerInfos:legendLayers
},"legendDiv");
//when the map extent is changed, refresh legend layers since layerInfos is used in legend constructor
dojo.connect(map, "onExtentChange", function(){
legend.refresh();
});
legend.startup();
});
map.addLayers([bndry,props,facils]);
dojo.connect(map,'onLayersAddResult',function(results){
//add check boxes
dojo.forEach(legendLayers,function(layer){
var layerName = layer.title;
var checkBox = new dijit.form.CheckBox({
name: "checkBox" + layer.layer.id,
value: layer.layer.id,
checked: layer.layer.visible,
onChange: function(evt) {
var clayer = map.getLayer(this.value);
clayer.setVisibility(!clayer.visible);
this.checked = clayer.visible;
}
});
//add the checkbox and label to the toc
dojo.place(checkBox.domNode,dojo.byId("toggle"),"after");
var checkLabel = dojo.create('label',{'for':checkBox.name, innerHTML:layerName},checkBox.domNode,"after");
dojo.place("<br />",checkLabel,"after");
});
});
} anyone see this problem before? edit: The problem seems to start at v2.7; changing to v2.5 or v2.6 there is no error, and everything works fine.
... View more
04-09-2012
08:35 AM
|
0
|
0
|
3213
|
|
POST
|
when zooming or panning a map, there are a blank white line apears on the map, how to solve this problem? example for test: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/map/map_main.html IT looks like a side effect of the animation on navigation. Try setting navigationMode:'classic' or fadeOnZoom:false in the map options and see if you like those (older) effects better.
... View more
04-06-2012
05:04 AM
|
0
|
0
|
509
|
|
POST
|
There is no direct way. You will have to either script or convert the data.
... View more
04-04-2012
07:04 AM
|
0
|
0
|
3435
|
|
POST
|
Does firebug report the update is going through? I had this issue where GETs were getting through but POSTs were not due to proxy/authentication issues. Is the service you are accessing secure? Can you do the update from the REST interface?
... View more
03-30-2012
09:38 AM
|
0
|
0
|
1081
|
|
POST
|
I'm trying to figure out how to use the Draw toolset in this sample as a "measuring stick": http://help.arcgis.com/en/webapi/javascript/arcgis/demos/toolbar/toolbar_draw.html What I'm trying to accomplish is that a user will be able to see the distance on the map from a starting point to the end point. What I already know is that this can be accomplished with a point-to-point distance measurement using the map method toScreen to get the coordinates and then simply calculating the distance (using our old friend Pythagoras) between the two points, but I'm at a loss how to do this with the Draw toolset. Instead of reinventing, is there a reason you are not using the measurement tool?
... View more
03-28-2012
09:05 AM
|
0
|
0
|
1018
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-22-2014 08:35 AM | |
| 1 | 05-02-2012 04:56 AM | |
| 1 | 10-29-2021 07:40 AM | |
| 1 | 10-28-2021 05:26 AM | |
| 1 | 07-17-2012 08:48 AM |
| Online Status |
Offline
|
| Date Last Visited |
03-01-2022
02:00 PM
|