Select to view content in your preferred language

DynamicLayer and ImageParameters

1088
2
Jump to solution
02-06-2014 12:11 AM
by Anonymous User
Not applicable
Original User: Murselinho

When I try to add dynamiclayer and some point on the map i am getting XmlHttpRequest Error on chrome debug console and that is
not reading  var imageparameter=new ImageParamaeter()
What is this problem and how can i solve ?

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;         };     });     }
0 Kudos
1 Solution

Accepted Solutions
by Anonymous User
Not applicable
Original User: JGBarclay

Your function arguments have been specified in the wrong order.

When you use require([]), function(){ };, the function arguments need to be specified in the same order that the modules have been required.

i.e.

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)      {


Also you don't need to require "dojo/domReady!" as your function is being called when your ajax request succeeds.

View solution in original post

0 Kudos
2 Replies
by Anonymous User
Not applicable
Original User: JGBarclay

Your function arguments have been specified in the wrong order.

When you use require([]), function(){ };, the function arguments need to be specified in the same order that the modules have been required.

i.e.

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)      {


Also you don't need to require "dojo/domReady!" as your function is being called when your ajax request succeeds.
0 Kudos
by Anonymous User
Not applicable
Original User: Murselinho

Thank you so so much friend :))
0 Kudos