Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to convert polygon from wkid 3301 to wkid 4326. I've been using this code snippet for converting points, but I'm not sure how I would accomplish this to create a polygon object. I'm not even sure if gsvc.project() is the best solution. Any suggestions would be appreciated.

var outSR = new esri.SpatialReference({ wkid: 4326 });
mapHandler.gsvc.project([ geometry ], outSR, function(projectedPoints) {
    pt = projectedPoints[0];
share|improve this question
up vote 2 down vote accepted

I ended up solving this with the following code:

mapHandler.gsvc.project([ geometry ], outSR, function(projectedPoints) {
    var polygonJSON = {"rings": projectedPoints[0].rings, "spatialReference": {"wkid": projectedPoints[0].spatialReference.wkid}};
    var polygon = new esri.geometry.Polygon(polygonJSON);
share|improve this answer
Welcome to the site, and thanks for posting the solution. You should mark this answer as accepted, so that future readers will quickly now what worked. Thanks. – user3461 Apr 25 '13 at 11:53
The system says I can accept my answer tomorrow. – ObviousCat Apr 25 '13 at 13:32
Great, thanks for following up and keeping the site's Q&A format working well. – user3461 Apr 25 '13 at 13:35
You should be able create straight from the JSON. var polygon = new esri.geometry.Polygon(projectPoints[0]); – awesomo Apr 26 '13 at 16:48
Thanks for clearing that up. – ObviousCat Apr 26 '13 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.