|
POST
|
Thanks Derek. the graphics layer doesn't implement onUpateEnd Can you please submit two enhancement requests: 1. a graphicsLayer should handle onUpdateStart and onUpdateEnd events 2. a graphicsLayer should interact with the Map's onUpdateStart and onUpdateEnd events The current behaviour seems like an oversight, since the map is aware of the layer's existence (map.graphicsLayerIds lists the graphicsLayer) but not its drawing status. If the graphics are still drawing, then really the map hasn't finished updating. So it's up to subclasses of Layer to implement onUpdateEnd. Is this responsibility Esri's (as authors of the JS API), or can we as 3rd party developers do anything about it? why not use a feature layer? It's less code, and you get the events you want. What are you trying to do? I'm running an unknown number of deferred queries, and I want to draw the results. I'll see whether I can draw them as a featureLayer based on a featureCollection, rather than a graphicsLayer. Cheers, Steve
... View more
05-11-2012
09:36 PM
|
0
|
0
|
1038
|
|
POST
|
As far as I can see, a GraphicsLayer doesn't fire the Map's onUpdateEnd event. 1) is that correct? 2) why doesn't it fire onUpdateEnd, given that it's a subclass of Layer, which does fire the onUpdateEnd event? To illustrate, run the attached code. The map and dynamic layer both fire the onUpdateEnd event, but the graphicsLayer doesn't. A workaround will be to create a featureLayer from a featureCollection based on the graphicsLayer - but why is this necessary? Thanks, Steve EDIT: it also appears that the map's onUpdateEnd will fire before the graphicsLayer has finished drawing? Try the code below, which is zoomed to the full extent of the USA. The map's onUpdateEnd event fires, then the graphics draw a few seconds later.
<!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" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Create Map</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
var map;
var graphicsLayer = new esri.layers.GraphicsLayer();
function init() {
//var startExtent = new esri.geometry.Extent(-83.41, 31.98, -78.47, 35.28, new esri.SpatialReference({wkid:4326}));
map = new esri.Map("map")//,{extent:esri.geometry.geographicToWebMercator(startExtent)});
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
var dynamicLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer");
map.addLayer(dynamicLayer);
var queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3");
//build query filter
var query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["*"];
query.outSpatialReference = {"wkid":102100};
query.where = "1=1";
queryTask.execute(query, addPointsToMap);
dojo.connect(map, "onLoad", function () {
dojo.connect(map, "onUpdateEnd", function() {
console.log("map update end");
});
dojo.connect(graphicsLayer, "onUpdateEnd", function() {
console.log("graphicsLayer update end");
});
dojo.connect(dynamicLayer, "onUpdateEnd", function() {
console.log("dynamic layer update end");
});
});
}
function addPointsToMap(featureSet) {
var 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),new dojo.Color([125,125,125,0.35]));
for (var i=0, il=featureSet.features.length; i<il; i++) {
var graphic = featureSet.features;
graphic.setSymbol(symbol);
graphicsLayer.add(graphic);
}
map.addLayer(graphicsLayer);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro"></body>
</html>
... View more
05-11-2012
04:40 AM
|
0
|
2
|
2994
|
|
POST
|
What i think is, you cannot get symbology in QueryTask from the server. Thanks Shreyas, I think you're right. If you want symbology, you may want to use the FeatureLayer. The FeatureLayer will, by default, use the drawing information (symbology and domains) from the server I'd normally do this, but in this particular case I want to obtain the features which would have been returned by the feature layer, without actually drawing them - hence the use of a query task based on the extent of the map. 5. Initialize the Symbol you want to use for displaying the highlighted features on the map. I'm trying to do this automatically based on the current queryTask parameters, since my map is dynamic and I won't know exactly which symbol(s) to use at run-time. I'll keep playing around with it and will report back if I come up with a workaround. Thanks, Steve
... View more
05-11-2012
04:21 AM
|
0
|
0
|
3534
|
|
POST
|
I'm trying to obtain the symbol which applies to a result returned by a queryTask. Is this possible? A query allows you to specify the fields to be returned, and whether the geometry should be returned, but it doesn't seem to return the symbol associated with a feature. The result of the queryTask is a featureSet, comprising the features which satisfy the query. Although feature.symbol is available, I'm finding that it's blank. To illustrate, put a breakpoint on line 36 of this Query sample and note that results.features[0].symbol is null, even though the source layer does have a renderer. A workaround is presumably to obtain the renderer associated with the query.URL and build up the symbol this way - any better ideas? Thanks, Steve
... View more
05-09-2012
07:34 PM
|
0
|
8
|
4366
|
|
POST
|
I see similar examples using esri.request but it doesn't seem like I should have to do an extra call to the service FWIW, I'd suggest that esri.request is a good approach to take here. Good luck, Steve
... View more
05-08-2012
09:12 PM
|
0
|
0
|
671
|
|
POST
|
A quick tip is to highlight your code then hit the # button above, to format it in a more readable manner. I think the problem is with the line: [LEFT]var featureLayer = new esri.layers.FeatureLayer("http://karthikpc:8399/arcgis/rest/services/Carriage_Mercantor/FeatureServer", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND, infoTemplate: infoTemplate, outFields: ["*"] });[/LEFT] You are missing the layer ID from the end. It should be something like http://karthikpc:8399/arcgis/rest/services/Carriage_Mercantor/FeatureServer/0 See the Feature Layer sample for further info. Steve
... View more
05-01-2012
10:14 PM
|
0
|
0
|
1045
|
|
POST
|
Your code has the onMouseOver event listening to the Map itself - you need to listen to the graphics:
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-14052134,"ymin":5562249,"xmax":-13179529,"ymax":5897349,"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:initExtent});
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
dojo.connect(map, "onLoad", function() {
var points = {
"points": [[-122.63,45.51],[-122.56,45.51],[-122.56,45.55],[-122.62,45.00],[-122.59,45.53]],
"spatialReference": ({ "wkid": 4326 })
};
var mp = new esri.geometry.Multipoint(points);
var wm_mp = esri.geometry.geographicToWebMercator(mp);
var sms = new esri.symbol.SimpleMarkerSymbol();
var infoTemplate = new esri.InfoTemplate("Bob","Lives in the USA");
var graphic = new esri.Graphic(wm_mp, sms, '', infoTemplate);
map.graphics.add(graphic);
dojo.connect(map.graphics, "onMouseOver", function(evt) {
var g = evt.graphic;
map.infoWindow.setContent(g.getContent());
map.infoWindow.setTitle(g.getTitle());
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
});
dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} );
});
}
Steve
... View more
04-26-2012
05:06 PM
|
0
|
0
|
2083
|
|
POST
|
The URL: http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/Soil_Survey_Map/MapServer shows under the "Single Fused Map Cache" header that it is true, indicating that the map is cached, which I believe means that you cannot adjust the visibility of the layers. Bingo - thanks for the tip. I wonder if this limitation is documented anywhere? Cheers, Steve
... View more
04-26-2012
03:35 PM
|
0
|
0
|
992
|
|
POST
|
See the demo script at http://help.arcgis.com/en/webapi/javascript/arcgis/demos/find/find_popup.html and put a Firebug breakpoint on line 91:
var feature = result.feature;
feature.attributes.layerName = result.layerName;
feature.attributes should return the attributes of the feature, but instead it returns the aliases: [ATTACH=CONFIG]13827[/ATTACH] This is a crucial distinction since the attributes are guaranteed to be unique whereas the aliases may not be. Ideally, feature.attributes should return the attributes while a new feature.aliases property could return the aliases. Thanks, Steve
... View more
04-25-2012
09:54 PM
|
0
|
0
|
963
|
|
POST
|
Hopefully this is a simple resolution - but I can't see what I'm doing wrong in attempting to set the visible layers of a Dynamic Map Service Layer. DynamicMap :: setVisibleLayers says that an array of [-1] will over-ride the layerInfos object and display no visible layers. But I'm finding that this is not the case: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.8/js/dojo/dijit/themes/claro/claro.css"> <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script> <script type="text/javascript"> dojo.require("esri.map"); function init() { var map = new esri.Map("map"); var layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Specialty/Soil_Survey_Map/MapServer"); map.addLayer(layer); dojo.connect(map, "onLayerAddResult", function(){ layer.setVisibleLayers([-1]); console.log(layer.visibleLayers); }); } dojo.addOnLoad(init); </script> </head> <body class="claro"> <div id="map" style="width:900px; height:600px; border:1px solid #000;"></div> </body> </html> Why is the layer still displaying when I've specified no visible layers? Similarly, whether I specify 0, 1 or 2 (the available layers in this sample service) the map draws the same. I've tried putting the setVisibleLayers line in various places, including after the layer has loaded as in this example. What am I doing wrong here? Thanks, Steve
... View more
04-25-2012
08:38 PM
|
0
|
2
|
1113
|
|
POST
|
Is the districtURL site public-facing? If not, can you show us the results of featureSet.features[0].geometry? Steve
... View more
04-16-2012
08:05 PM
|
0
|
0
|
1889
|
|
POST
|
I uploaded a revised version of the application that includes a connect and disconnect. It still does not disconnect. There is a variable identifyHandle at the top, a dojo.connect when the map loads and then I created another connect for the identify button and a disconnect for the measure button. Chris, Your code is fairly complicated and it'll take time to trawl through it looking for the right sections. Can you make it a bit easier by highlighting in which files the variables are set? Cheers, Steve
... View more
04-16-2012
03:08 PM
|
0
|
0
|
1962
|
|
POST
|
This clumsy workaround is the only one I could come up with as well, due to the exact limitation you listed. Sounds like an enhancement request for Esri. We'd need a boolean property for "will display at the current scale". This should apply to featureLayers and tiledMapServiceLayers, and for each layer of a dynamicMapServiceLayer. Cheers, Steve
... View more
04-12-2012
03:21 PM
|
0
|
0
|
1592
|
|
POST
|
Would they be able to use the getscale method for the map? http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/namespace_geometry.htm#getScale Cool, thanks for the tip. I wasn't aware of that. (strange that it's not just a property of the map, though)
... View more
04-12-2012
03:14 PM
|
0
|
0
|
1592
|
|
POST
|
Is there a way to determine whether a layer is switched on, but is not currently shown due to the scale threshold? See the attached file for an example. When the map first loads, the counties layer is "on" but is not shown due to the map scale. Zoom in a level and and the counties appear. How can I determine this programmatically? featureLayer.visible returns "true" at all scales. featureLayer.onVisibilityChange doesn't fire when the scale threshold is crossed. The workaround is to check the current map scale (by finding the LOD and figuring out the corresponding scale?) and compare it to the layer's minScale and maxScale. This seems like a clumsy workaround - is it the only option? Thanks, Steve
... View more
04-11-2012
11:04 PM
|
0
|
6
|
2138
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-17-2014 08:45 PM | |
| 1 | 03-15-2011 04:23 PM | |
| 1 | 10-18-2019 12:50 AM | |
| 3 | 01-22-2019 02:33 PM | |
| 1 | 09-26-2011 10:36 PM |
| Online Status |
Offline
|
| Date Last Visited |
10-20-2022
12:19 AM
|