Solved! Go to Solution.
geometryService.project(multipoint.points, map.spatialReference, function (results)
geometryService.project(multipoint, map.spatialReference, function (results)
multipoint.points are not the type of Point geometry, but an array of coordinates in number type. Multipoint is a valid geometry type that can be fed into geometryService.project directly.
Try to change:geometryService.project(multipoint.points, map.spatialReference, function (results)
To:geometryService.project(multipoint, map.spatialReference, function (results)
var multipoint = new Multipoint(map.spatialReference); for (i = 0; i < arrycoord.length; i = i + 2) { var x = arrycoord; var y = arrycoord[i + 1]; var point = new Point(); point.x = x; point.y = y; multipoint.addPoint(point); };
var x, y, point; var multipoint = new Multipoint(map.spatialReference); for (i = 0; i < arrycoord.length; i = i + 2) { x = arrycoord; y = arrycoord[i + 1]; point = new Point(x,y); multipoint.addPoint(point); };
var x, y, point; var initColor = "#ce641d"; for (i = 0; i < arrycoord.length; i = i + 2) { x = arrycoord; y = arrycoord[i + 1]; point = new Point(x, y, new SpatialReference({ wkid: 4326 })); // it should work without reprojecting the point. If not working, then reproject it. map.graphics.add(graphic); // comment this line out if using the reproject approach //geometryService.project(point, map.spatialReference, function (newPoint) { // var graphic = new Graphic(newPoint, createSymbol(initColor)); // map.graphics.add(graphic); //}); };
var x, y, point, graphic; var symbol = createSymbol("#ce641d"); var srLatLon = new SpatialReference({ wkid: 4326 }); for (i = 0; i < arrycoord.length; i = i + 2) { x = arrycoord; y = arrycoord[i + 1]; point = new Point(x, y, srLatLon); graphic = new Graphic(point, symbol); map.graphics.add(graphic); };
var x, y, point, graphic; var symbol = createSymbol("#ce641d"); var srLatLon = new SpatialReference({ wkid: 4326 }); for (i = 0; i < arrycoord.length; i = i + 2) { x = arrycoord; y = arrycoord[i + 1]; point = new Point(x, y, srLatLon); geometryService.project(point, map.spatialReference, function (newPoint) { var graphic = new Graphic(newPoint, symbol); map.graphics.add(graphic); }); };
function createSymbol(color) { return new esri.symbol.SimpleMarkerSymbol( esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, // change to the style you like 16, // change to the size you like null, new dojo.Color(color) ); };