I have an issue where I have my map in Kentucky Single Zone (projected coordinate system) - the base layers I am using are in KY Single Zone - and when I try to bring in a FeatureLayer using MODE_ONDEMAND, the points I am trying to display from the service do not display. I did a console.log on the featurelayer, and it is coming up (looking in Firebug). But looking at the graphics node in Firebug, the geometry for the points are in Decimal Degree Geographic coordinates (yet, strangely with wkid=3089 - which is projected KY Single Zone) - even though the fullextent property shown is correctly in KY Single Zone coordinates. The service I am using for the FeatureLayer is in KY Single Zone and is a MapServer service. I also did some testing, and using a Decimal Degree map, the FeatureLayer points display as expected.Now, if I change the FeatureLayer to MODE_SNAPSHOT - it works. Actually, MODE_SNAPSHOT works no matter what projection the service I am using for the FeatureLayer is in. So the FeatureLayer seems to appropriately project to the map - which I would expect.I should say that the service I am using for this FeatureLayer is built from an table event theme using Decimal Degree x,y coordinates - but that shouldn't matter since the service is projected anyway?I really need to use MODE_ONDEMAND because I'd like to limit the features I bring back by extents - and I also need to limit the number of features.So here are my questions:- why does MODE_ONDEMAND graphics only display in Decimal Degree despite my service being in KY Single Zone? This makes no sense. And MODE_SNAPSHOT works?- anybody know any workarounds?- is this an issue with 9.3.1 services - because that's the version of ArcGIS Server I'm running right now (yeah, I know - upgrade. but I haven't had a chance - and there's nothing in the documentation that suggests this is an issue).I am including the entire map service code below for the MODE_ONDEMAND - if you simply change it to MODE_SNAPSHOT, the points display. Thanks!<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<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>
Class Breaks Renderer
</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">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.2">
</script>
<script type="text/javascript" charset="utf-8">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("esri.layers.FeatureLayer");
var map;
var attributeField = "results";
function init() {
//Kentucky extent - in KY SingleZone
var initialExtent = new esri.geometry.Extent(3336800.8350631, 2636200.25720764, 6477996.0793392, 5025218.13686783, new esri.SpatialReference({wkid: 3089}));
map = new esri.Map("map", {nav:true,extent:initialExtent});
dojo.connect(map, "onLoad", initOperationalLayer);
map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://kygisserver.ky.gov/ArcGIS/rest/services/KY1Z_Services/KyImage2010/MapServer"));
}
function initOperationalLayer() {
var featureLayer = new esri.layers.FeatureLayer("http://128.163.2.13/arcgis/rest/services/KYWater/KYGWQuality/MapServer/1", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"]
});
featureLayer.setDefinitionExpression("AnalyteID LIKE 'S1706' AND results IS NOT NULL");
var query = new esri.tasks.Query();
query.where = "AnalyteID LIKE 'S1706' AND results IS NOT NULL";
featureLayer.queryFeatures(query, function(featureSet) {
var features = featureSet.features;
console.log(features.length)
var min = max = parseFloat(features[0].attributes[attributeField]);
dojo.forEach(features, function(feature) {
min = Math.min(min, feature.attributes[attributeField]);
max = Math.max(max, feature.attributes[attributeField]);
});
//divide the range of values by the number of classes to find the interval
var numRanges = 5;
var breaks = (max - min) / numRanges;
var outline = new esri.symbol.SimpleLineSymbol().setWidth(1);
var fillColor = new dojo.Color([240, 150, 240, 0.75]);
var defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setSize(1).setOutline(outline);
var renderer = new esri.renderer.ClassBreaksRenderer(defaultSymbol, attributeField);
//add the breaks using the interval calculated above
for (var i = 0; i < numRanges; i++) {
renderer.addBreak(parseFloat(min + (i * breaks)), parseFloat(min + ((i + 1) * breaks)), new esri.symbol.SimpleMarkerSymbol().setSize((i + 1) * 6).setColor(fillColor).setOutline(outline));
}
featureLayer.setRenderer(renderer);
});
console.log(featureLayer)
map.addLayer(featureLayer);
}
dojo.addOnLoad(init);
</script>
</head>
<body>
<div id="map" class="claro" style="width:800px; height:600px; border:1px solid #000;">
</div>
</body>
</html>