var strPoints; // add code to populate strPoints here. require([ "esri/map", "esri/geometry/Extent", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/graphic", "esri/tasks/GeometryService", "dojo/_base/array", "dojo/_base/lang", "dojo/_base/Color", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/domReady!" ], function (Map, Extent, Point, SimpleMarkerSymbol, Graphic, GeometryService, arrayUtiles, lang, Color, ArcGISDynamicMapServiceLayer) { var initialExtent = new Extent({ "xmin": 2306896.79, "ymin": 7278537, "xmax": 2710915.5, "ymax": 7674860.5, "spatialReference": { "wkid": 2953 } }); //102100, 2953 var map = new Map("NBmap", { extent: initialExtent }); var basemaplayer = new ArcGISDynamicMapServiceLayer("http://swv25orat01.gnb.ca:6080/arcgis/rest/services/WFRS/WFRS_FireSummarymxd/MapServer"); map.addLayer(basemaplayer); map.on("load", function() { map.disablePan(); map.disableScrollWheelZoom(); map.hideZoomSlider(); var geometryService = new GeometryService("http://tasks.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); var arrycoord = strPoints.split(","); var x, y, point; var symbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CIRCLE, 16, null, new Color("#ce641d") ); for (i = 0; i < arrycoord.length; i = i + 2) { x = arrycoord; y = arrycoord[i + 1]; point = new Point(x, y); geometryService.project(point, map.spatialReference, function (newpoint) { var graphic = new Graphic(newpoint, 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); 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) ); };
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 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); };
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)
geometryService.project(multipoint.points, map.spatialReference, function (results)
geometryService.project(multipoint, map.spatialReference, function (results)
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.