A Reprojection on ESRI JS API can be done in two ways; I have used the project() method from Geometry Object.
This method has little bit of overhead, since it makes a graphic object and then gives us a four corners back, but it works.
var gsvc = new esri.tasks.GeometryService("http://sampleserver1a.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer");
getImageUrl: function(extent, width, height, callback) {
var symbol = new esri.symbol.SimpleMarkerSymbol();
var sfs = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_NONE, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT,
new dojo.Color([255,0,0]), 2),new dojo.Color([255,255,0,0.25]));
var extent = new esri.geometry.Extent(184594.889984, 27695.579988, 570505.380020, 231505.920012, new esri.SpatialReference({ wkid:26985 }));
//xmin:184594.889984,ymin:27695.579988,xmax:570505.380020,ymax:231505.920012,spatialReference:{wkid:26985}
var graphic = new esri.Graphic(extent, sfs);
var outSR = new esri.SpatialReference({ wkid: 4326});
var test = gsvc.project([ graphic ], outSR, function(features) {
pt = features[0].geometry;
});
//dojo.byId("latlong").innerHTML = " xmin = " + pt.xmin + "
ymin = " + pt.ymin + "
xmax = " + pt.xmax + "
ymax = " + pt.ymax;
var params = {
action:"GetMapTile",
Layers:"W,T",
format:"png",
Opacity:"100,55",
//changing values
Corner1:extent.ymin + "|" + extent.xmin,
Corner2:extent.ymax + "|" + extent.xmax,
width: width,
height: height
};
callback("http://wmsserver/wms11?" + dojo.objectToQuery(params));
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment