var url = []; var map; var imageParameters; var dynamicMapServiceLayer; var iconPath = "M24....39.0z"; var points = []; var initColor = "#ce641d"; $(document).ready(function () { LoadXml(); }); function LoadXml() { $.ajax({ url: '/xml/arcservices.xml', type: "GET", dataType: "xml", success: function (xml) { $(xml).find('services').each(function () { url[0] = $(this).find("url").text() //services reading from xml }); LoadMap(url); } }); } function LoadMap(serviceUrl) { require(["esri/map","esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/graphic","dojo/_base/array", "dojo/dom-style", "dojo/domReady!", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ImageParameters", "esri/tasks/GeometryService", "esri/tasks/ProjectParameters"], function (Map, Point, SimpleMarkerSymbol, Graphic, arrayUtils, domStyle, ImageParameters, ArcGISDynamicMapServiceLayer) { map = new Map("map", { sliderOrientation: "horizontal" }); map.on("load", mapLoaded); function mapLoaded() { var points = [[28.81498534, 40.95834425], [28.89585187, 40.99108314], [28.87908989, 40.97545093], [28.90308632, 41.00276167], [28.90076176, 40.99023319],[28.90277699, 41.00997324], [28.90288352, 41.00577338], [28.90445992, 40.98692034]]; arrayUtils.forEach(points, function (point) { var graphic = new Graphic(new Point(point), createSymbol(iconPath, initColor)); map.graphics.add(graphic); }); imageParameters = new ImageParameters(); imageParameters.format = "jpeg"; //set the image type to PNG24, note default is PNG8. dynamicMapServiceLayer = new ArcGISDynamicMapServiceLayer(serviceUrl[0], { "opacity": 0.8, "imageParameters": imageParameters }); map.addLayer(dynamicMapServiceLayer); }; function createSymbol(path, color) { var markerSymbol = new esri.symbol.SimpleMarkerSymbol(); markerSymbol.setPath(path); markerSymbol.setColor(new dojo.Color(color)); markerSymbol.setOutline(null); return markerSymbol; }; }); }
Solved! Go to Solution.
function LoadMap(serviceUrl) { require([ "esri/map", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/graphic", "dojo/_base/array", "dojo/dom-style", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ImageParameters", "esri/tasks/GeometryService", "esri/tasks/ProjectParameters" ], function (Map, Point, SimpleMarkerSymbol, Graphic, arrayUtils, domStyle, ArcGISDynamicMapServiceLayer, ImageParameters, GeometryService, ProjectParameters) {
function LoadMap(serviceUrl) { require([ "esri/map", "esri/geometry/Point", "esri/symbols/SimpleMarkerSymbol", "esri/graphic", "dojo/_base/array", "dojo/dom-style", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ImageParameters", "esri/tasks/GeometryService", "esri/tasks/ProjectParameters" ], function (Map, Point, SimpleMarkerSymbol, Graphic, arrayUtils, domStyle, ArcGISDynamicMapServiceLayer, ImageParameters, GeometryService, ProjectParameters) {