|
POST
|
Hi Kelly, Try making a legend from the feature service at: http://203.14.35.213/ArcGis1/rest/services/atlas/NaturalEnvironment_NationalParks/MapServer/0 I'm finding that the Other category appears 4 times, as there are 4 classes which I've combined into a single class. Thanks, Steve
... View more
03-15-2011
04:58 PM
|
0
|
0
|
2637
|
|
POST
|
In case anyone else needs to know, the answer is to use layer.setMaxAllowableOffset to change the value of an existing layer. If you change this on the onZoomEnd event, you can set it to the appropriate value for any scale.
... View more
03-15-2011
04:56 PM
|
0
|
0
|
789
|
|
POST
|
I'm trying to highlight features when the mouse is above them, as in the sample at http://help.arcgis.com/en/webapi/javascript/arcgis/demos/query/query_hover.html Listening for onMouseOver and onMouseOut events works fine with polygons. The problem is when hovering over point features - I'm finding that it flickers constantly between onMouseOver and onMouseOut. Try this sample code for an example. I'm displaying a highlight graphic when the mouse is over the point feature, and removing it when the mouse is moved. It's almost impossible to hold the mouse exactly over the point feature. Any ideas how to resolve this? Is it possible to put a timer on the onMouseOver event, so that it doesn't constantly flick to the onMouseOut event? Thanks, Steve <!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" />
<!--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>FeatureLayer On Demand</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
</style>
<script type="text/javascript">djConfig = { parseOnLoad:true };</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.2"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.form.Button");
dojo.require("dijit.Dialog");
var mapLayers = []; //array of layers in client map
var map;
var highlightPoint = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 12, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,144,0]), 1), new dojo.Color([255,144,0,0.25]));
var highlightGraphic;
function init() {
var extent = new esri.geometry.Extent({"xmin":-96.6063,"ymin":38.3106,"xmax":-96.4764,
"ymax":38.3689,"spatialReference":{"wkid":4269}});
map = new esri.Map("map", { extent: esri.geometry.geographicToWebMercator(extent)});
var imagery = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
map.addLayer(imagery);
var content = "<b>Pop</b>: ${POP2000}" + "<br /><b>Households</b>: ${HOUSEHOLDS}";
var infoTemplate = new esri.InfoTemplate("Census", content);
var featureLayer = new esri.layers.FeatureLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/0",{
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: infoTemplate
});
map.addLayer(featureLayer);
map.infoWindow.resize(150,85);
dojo.connect(featureLayer, "onMouseOver", function (evt) {
map.setMapCursor("pointer");
map.graphics.remove(highlightGraphic);
highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightPoint);
map.graphics.add(highlightGraphic);
});
dojo.connect(featureLayer, "onMouseOut", function () {
map.setMapCursor("default");
map.graphics.remove(highlightGraphic);
});
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div style="position:relative;width:100%;height:100%;">
<div id="map" style="border:1px solid #000;width:100%;height:100%;"></div>
</div>
</body>
</html>
... View more
03-15-2011
04:23 PM
|
1
|
3
|
4558
|
|
POST
|
I just read Matthew's advice - I'd say it's spot on, and describes my experiences very well. As a non-Computer Science person I found JavaScript relatively easy to pick up, using similar techniques to Matthew's. For a good free JavaScript editor I'm really happy with http://www.yaldex.com/Free_JavaScript_Editor.htm Good luck, Steve
... View more
03-02-2011
04:49 PM
|
0
|
0
|
1521
|
|
POST
|
I've had discussions in the past about appropriateness/sensitivity in using associative colours when mapping ethnicities and am wondering where this design decision came from? Some people may argue using associative colours for ethnicities is derogatory. Hi Donovan, Interesting question - I honestly didn't think of this. I matched the colour schemes in the Atlas Explorer's maps with the CMYK colours used in the printed book on which this site was based. The maps in the book were designed by professional cartographers at NSW LPMA, and the colours were chosen by them. You can see the associated map at the bottom of http://atlas.nsw.gov.au/public/nsw/home/topic/article/indigenous-population.html We did consider using a single colour scheme for all maps (eg red = more, pink = less) but decided to match the colours used in the book, as it provides a bit of visual variety. I'd be interested to hear whether anyone else feels the colours are inappropriate - we're amenable to making changes if it's a problem. Cheers, Steve
... View more
03-02-2011
01:29 PM
|
0
|
0
|
1783
|
|
POST
|
Kevin and Jeremy, Thanks for the kind words. I can't take any credit for the site design or article navigation, but I'll pass that on to the guys responsible. I'll be at the Dev Summit next week, and in fact I'm giving a presentation on the lessons I learnt from this project (Wednesday 11:15am). Come along and say hi if you can. Jeremy, I'd love to schedule a meeting with you to discuss JSAPI stuff. Cheers, Steve PS after James Fee's post, at one stage we had more visits from the US than from NSW 🙂
... View more
03-02-2011
11:22 AM
|
0
|
0
|
1783
|
|
POST
|
A colleague found the answer for me - there is a method on the Layer class called setMaxAllowableOffset. Calling this from the onZoomEnd function did what I needed - hope this helps someone in the future.
... View more
02-23-2011
01:47 PM
|
0
|
0
|
362
|
|
POST
|
The documentation at http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/featurelayer.htm shows the maxAllowableOffset property as an option under esri.layers.FeatureLayer(url, options?) In all the example, this property is set when the new object is created. My question is whether the maxAllowableOffset property can be changed after the featureLayer has been created. Specifically, I wish to recalculate the value when the zoom level changes - I'm having mixed results trying to do so. Thanks for any advice, Steve
... View more
02-22-2011
08:13 PM
|
0
|
1
|
887
|
|
POST
|
I'm happy to report that the site I've been working on is now live at http://atlas.nsw.gov.au It's the online version of a 200+ page book which aims to provide loads of information about the state of New South Wales, written by experts across government, industry and academia. The target audience is the general public, including students. The Atlas Explorer mapping application uses ArcGIS Server 10 and the JavaScript API v2.1 including many of the new features like time-aware layers, feature layers, legends, etc. It's still in beta mode, so please let me know what you think, and if you run into any errors or problems, so we can fix them ASAP. Thanks to everyone for the assistance thus far, especially Kelly from the JS team. Cheers, Steve
... View more
02-17-2011
01:52 PM
|
0
|
7
|
2178
|
|
POST
|
I have a set of multiple census layers, where the largest scale layer is very detailed over heavily populated areas, and quite coarse over remote areas. I need to display the detailed layer when it makes sense to do so - which is not necessarily at the same scale across the entire map. These screenshots illustrate the problem. At a scale of 1:500k the layer should display in rural areas: But in urban areas, the layer shouldn't display until about 1:100k: Using the JavaScript API and REST layers, is there any way to count the features in the current map extent, and turn the layer off/on accordinly? Eg, if there are fewer than 50 polygons, show the detailed layer, otherwise show the coarse layer. Thanks, Steve
... View more
02-10-2011
07:49 PM
|
0
|
1
|
950
|
|
POST
|
http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/featurelayer.htm shows that a featureLayer can have a MaxAllowableOffset value, which can be useful in quickly drawing a complex layer (simplying it on-the-fly rather than trying to draw every vertex exactly). The problem is that the applicable offset value will usually change depending on the current map scale. Eg, at a state level an applicable offset might be 100 meters, while at street level it will be 1 meter. Is there a way to accommodate this using the MaxAllowableOffset parameter? Because the MaxAllowableOffset parameter is found under the New keyword, can it be changed as the scale changes? Ideally this parameter should be configurable as a factor, eg 1/1000 of the current map width or similar. Thanks, Steve
... View more
01-16-2011
05:13 PM
|
0
|
4
|
1234
|