|
POST
|
1. I'm not seeing a 403 when I load that url...it loads for me. This sample uses it and runs fine for me: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/mobile/mobile_simplemap.html 2. Can you link to the doc that says the compact build is ~30kB? The compact build doc page says that the compact version is 53kB smaller than the standard version and this (roughly) matches up with what I see. The compact version weighs in at about 125kB on the sample above where as the standard version comes in at about 185kB in this sample: http://help.arcgis.com/en/webapi/javascript/arcgis/demos/map/map_topo.html
... View more
05-12-2011
07:16 AM
|
0
|
0
|
1082
|
|
POST
|
How about this: <!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>change feature layer selection color on the fly</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dijit/themes/claro/claro.css">
<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");
var selectionToolbar, featureLayer;
var syms = {}
function init() {
// populate the object used to set the
// feature layer selection symbol
syms.red = new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([255,0,0,0.5]));
syms.blue = new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([0,0,255,0.5]));
syms.green = new esri.symbol.SimpleFillSymbol().setColor(new dojo.Color([0,255,0,0.5]));
var initialExtent = new esri.geometry.Extent(-97.5328,37.4344,-97.2582,37.64041, new esri.SpatialReference({wkid:4326}) );
var map = new esri.Map("map", { extent: esri.geometry.geographicToWebMercator(initialExtent), slider: true, nav: true });
dojo.connect(map, "onLoad", initSelectToolbar);
var baseMapLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(baseMapLayer);
var content = "<b>Status</b>: ${STATUS}" +
"<br><b>Cummulative Gas</b>: ${CUMM_GAS} MCF" +
"<br><b>Total Acres</b>: ${APPROXACRE}" +
"<br><b>Avg. Field Depth</b>: ${AVG_DEPTH} meters";
var infoTemplate = new esri.InfoTemplate("${FIELD_NAME}", content);
featureLayer = new esri.layers.FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Petroleum/KSPetro/MapServer/1",{
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
infoTemplate: infoTemplate,
outFields: ["*"]
});
featureLayer.setDefinitionExpression("PROD_GAS='Yes'");
featureLayer.setSelectionSymbol(syms[dojo.byId('color-select').value]);
dojo.connect(featureLayer, "onSelectionComplete", sumGasProduction);
dojo.connect(featureLayer, "onSelectionClear", function(features) {
dojo.byId('messages').innerHTML = "<i>No Selected Fields</i>";
});
//*
// connect to the drop-down's onchange event and
// change the feature layer's selection color
dojo.connect(dojo.byId('color-select'), 'onchange', function(evt) {
featureLayer.clearSelection();
featureLayer.setSelectionSymbol(syms[evt.target.value]);
});
//*/
map.addLayer(featureLayer);
}
function initSelectToolbar(map) {
selectionToolbar = new esri.toolbars.Draw(map);
var selectQuery = new esri.tasks.Query();
dojo.connect(selectionToolbar, "onDrawEnd", function(geometry) {
selectionToolbar.deactivate();
selectQuery.geometry = geometry;
featureLayer.selectFeatures(selectQuery, esri.layers.FeatureLayer.SELECTION_NEW);
});
}
function sumGasProduction(features) {
var productionSum = 0;
//summarize the cummulative gas production to display
dojo.forEach(features, function(feature) {
productionSum = productionSum + feature.attributes.CUMM_GAS;
});
dojo.byId('messages').innerHTML = "<b>Selected Fields Production: " + productionSum + " mcf. </b>";
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<button dojoType="dijit.form.Button" onClick="selectionToolbar.activate(esri.toolbars.Draw.EXTENT);">Select Fields</button>
<button dojoType="dijit.form.Button" onClick="featureLayer.clearSelection();">Clear Selection</button><br>
<select id="color-select">
<option>red</option>
<option>blue</option>
<option>green</option>
</select>
<div id="map" style="position: relative; width:700px; height:500px; border:1px solid #000;"></div>
<span id="messages"></span>
</body>
</html> Also try it on JS Fiddle: http://jsfiddle.net/swingley/HeJux/
... View more
05-11-2011
03:31 PM
|
0
|
0
|
886
|
|
POST
|
Can you post a simplified version of your page that generates the error?
... View more
05-11-2011
11:43 AM
|
0
|
0
|
1970
|
|
POST
|
When you get your geocoding result, you can use that to construct a point (esri.geometry.Point) and use that point to query your polygon layer. This sample shows how to execute multiple queries: Query for polygon and adjacent polygons.
... View more
05-11-2011
11:30 AM
|
0
|
0
|
1106
|
|
POST
|
Isn't this more of an OpenLayers question? If you haven't already, maybe take this over to their users mailing list?
... View more
05-11-2011
11:27 AM
|
0
|
0
|
950
|
|
POST
|
Thanks for the follow-up and update! Glad you're making some progress.
... View more
05-11-2011
11:21 AM
|
0
|
0
|
1455
|
|
POST
|
Take a look at the compare maps sample: http://www.arcgis.com/home/webmap/templates/Compare/Configure/index.html More info: http://www.arcgis.com/home/item.html?id=a35a934152dc44dda8d793a2303f0df1 Relevant code is the syncMapLocations() function here: http://www.arcgis.com/home/webmap/templates/Compare/Configure/javascript/layout.js
... View more
05-09-2011
08:14 AM
|
0
|
0
|
884
|
|
POST
|
Right, properties are available when the layer is loaded. They're not necessarily available immediately after calling calling a layer constructor hence the reason you need to listen to the layer's onLoad event if you want to access layer properties as soon as the layer loads. This isn't explicitly spelled out in the feature layer documentation you linked to but it is documented for all layers in the Layer class documentation: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi/layer.htm When the layer is loaded, the value becomes "true", and layer properties can be accessed. The onLoad event is also fired.
... View more
05-06-2011
10:50 AM
|
0
|
0
|
1671
|
|
POST
|
Glad to help. I wouldn't say this is a feature or a bug...it's just the asynchronous nature of JavaScript. You can't always assume that because a line of code comes after a variable definition that all properties of that variable are populated and accessible. Reading up on callbacks and how they're used in JavaScript would be a good idea. Here's a good start: Getting comfortable with Javascript callbacks Money quote: when you call a method, you know that it has done all of its work and returned something useful. Right? Well�?� not always. Sometimes that method will invoke web requests that need some time to process, or it may call another method that has to do some processing or is waiting for user input�?� These kinds of operations can be implemented asynchronously, and the only way to manage that logic programmatically is with a callback parameter. I agree on the point about using fields that use domains...there's room for improvement there.
... View more
05-06-2011
10:00 AM
|
0
|
0
|
1671
|
|
POST
|
I did a little testing and it looks like these errors are related to the feature layer, not your query task. I vaguely remember seeing something like this shortly after feature layers landed in the JS API but don't recall ever finding a solution.
... View more
05-06-2011
09:50 AM
|
0
|
0
|
887
|
|
POST
|
Those properties aren't defined until your feature layer loads...try: var mapLayer= new esri.layers.FeatureLayer(layer.url,{
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: ["*"]
});
dojo.connect(mapLayer, 'onLoad', function() {
alert(mapLayer.fields); (undefined)
alert(mapLayer.version); (undefined)
});
... View more
05-06-2011
09:30 AM
|
0
|
0
|
1671
|
|
POST
|
@jeff can you post some code that's not working for you?
... View more
05-06-2011
08:17 AM
|
0
|
0
|
1671
|
|
POST
|
Understood. Web mercator *should* be here to stay for a while...I don't see it going anywhere unless the big guys (Google, Bing) change things up (not likely, IMO).
... View more
05-06-2011
07:33 AM
|
0
|
0
|
2767
|
|
POST
|
Since executeForCount returns a dojo.Deferred, I wonder if you could keep a reference to these and cancel previous, unresolved queryTasks before firing off a new query when the client does something (e.g. zoom in ten times quickly) that causes a lot of these to be fired. Just thinking out loud here...I haven't actually tried this.
... View more
05-06-2011
07:04 AM
|
0
|
0
|
887
|
|
POST
|
Glad you got it worked out! Your map will use the spatial reference of the first layer you add (but I think you figured this out :)). If you're concerned about performance, I would suggest that you re-project your data being used in your feature layer(s) because it will result in faster response times from your services as your server won't need to re-project to web mercator on the fly.
... View more
05-06-2011
06:59 AM
|
0
|
0
|
2767
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-23-2012 07:54 AM | |
| 1 | 05-28-2010 08:31 AM | |
| 1 | 11-12-2012 08:12 AM | |
| 3 | 02-23-2012 10:57 AM | |
| 1 | 06-27-2011 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|