I've polygon data as
I was able to project point using similar data on new spatial reference wkid=3857, but not happening with polygon.
Please tell me which method to use to project polygon using geometry service.
EDITED CODE:
function addGraphic() { var wkt = new Wkt.Wkt(); wkt.read("POLYGON ((1645481.0939999996 6124506.9885, 1645470.0473999996 6124473.5406, 1645475.7094 6124440.1391,1645481.0939999996 6124506.9885))"); var polygon = wkt.toObject(); //set the spatialreference polygon.SpatialReference = new esri.SpatialReference({wkid: 2193}); var outSR = new esri.SpatialReference({ wkid: 3857 }); var gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); var projPoly; gsvc.project([polygon], outSR, function (outGeom) { projPoly = outGeom[0]; var symbol = new esri.symbol.SimpleFillSymbol().setStyle(esri.symbol.SimpleFillSymbol.STYLE_SOLID); var polygonGraphic = new esri.Graphic(projPoly, symbol); map.graphics.add(polygonGraphic); }); }
أكثر...
POLYGON ((1645481.0939999996 6124506.9885, 1645470.0473999996 6124473.5406, 1645475.7094 6124440.1391,1645481.0939999996 6124506.9885))
in wkid=2193
I want to project this polygon using geometry service with new spatial reference wkid= 3857.in wkid=2193
I was able to project point using similar data on new spatial reference wkid=3857, but not happening with polygon.
Please tell me which method to use to project polygon using geometry service.
EDITED CODE:
function addGraphic() { var wkt = new Wkt.Wkt(); wkt.read("POLYGON ((1645481.0939999996 6124506.9885, 1645470.0473999996 6124473.5406, 1645475.7094 6124440.1391,1645481.0939999996 6124506.9885))"); var polygon = wkt.toObject(); //set the spatialreference polygon.SpatialReference = new esri.SpatialReference({wkid: 2193}); var outSR = new esri.SpatialReference({ wkid: 3857 }); var gsvc = new esri.tasks.GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); var projPoly; gsvc.project([polygon], outSR, function (outGeom) { projPoly = outGeom[0]; var symbol = new esri.symbol.SimpleFillSymbol().setStyle(esri.symbol.SimpleFillSymbol.STYLE_SOLID); var polygonGraphic = new esri.Graphic(projPoly, symbol); map.graphics.add(polygonGraphic); }); }
أكثر...