AnsweredAssumed Answered

gsvc.project([ graphic ], outSR, function(features) method does not run

Question asked by prasannarb on Nov 15, 2012
Latest reply on Nov 16, 2012 by Arkitech
Hi,
I am new to this Arcgis javascript API.
    function projectToWebMercator(evt) {       map.graphics.clear();       var point = evt.mapPoint;       var symbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_DIAMOND);       var graphic = new esri.Graphic(point, symbol);       var outSR = new esri.SpatialReference({ wkid: 102113});       map.graphics.add(graphic);       alert("Before method");       gsvc.project([ graphic ], outSR, function(features) {         alert("inside method");         pt = features[0].geometry;         graphic.setInfoTemplate(new esri.InfoTemplate("Coordinates",           "<p> X: " + pt.x +           "<br/> Y: " + pt.y +           "</p>"  +           "<input type='button' value='Convert back to LatLong' onclick='projectToLatLong();' />" +           "<div id='latlong'></div>"));         map.infoWindow           .setTitle(graphic.getTitle())           .setContent(graphic.getContent())           .show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint));       });     }



In the above code, gsvc.project([ graphic ], outSR, function(features) method does not run. I get the "Before method"-alert. But I don't get "inside method"-alert. Please do help me in resolving the issue. What could be the possible solution?

PS: I have declared gsvc as a global variable and defined it inside a init() function like
gsvc = new esri.tasks.GeometryService("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");


Thanks
Prasanna

Outcomes