I am querying a service that returns back a polygon dataset which have geographic coordinates. I want to convert the coordinates to WebMercator coordinates so the polygon can be displayed in the correct location. I have tried several things with little success. This seems extremely easy to accomplish but I'm just missing something. Any help is appreciated. Here is the code I'm using that displays the polygon in geographic coordinates.var responseObj = eval('(' + response + ')');
var fs = new esri.tasks.FeatureSet(responseObj.RecordSet);
for (var i = 0; i < fs.features.length; i++) {
var gra = fs.features;
if (i == 0) {
var polySymbolBlue = new esri.symbol.SimpleFillSymbol();
polySymbolBlue.setOutline(new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([0, 0, 0, 1]), 1));
polySymbolBlue.setColor(new dojo.Color([48, 48, 100, 1]));
gra.setSymbol(polySymbolBlue);
}
map.graphics.add(gra);
// Zoom to the collection of features
map.setExtent(esri.graphicsExtent(fs.features));
}
Here is a sample of what is returned from the service that the responseObj variable gets populated from: {"TaskMessagesArray":[],"StdGeographiesFeatures":[{"FeatureID":"718","FeatureName":"Jackson,MS"}],
"RecordSet":{"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":4326},
"features":[{"attributes":{"ID":"718","NAME":"Jackson,MS",
"Gen4_Length":13.660685252638258,"Gen4_Area":3.4404911073537887},
"geometry":{"rings":[[[-91.043553,32.57627],
.................
,[-91.043553,32.57627]]],"spatialReference":{"wkid":4326}}}]}}