Print BaseDynamicLayer behinde proxy with PrintTask

94
0
03-15-2019 02:56 AM
RubyStroschein
New Contributor III

Is it possible to print with PrintTask custom BaseDynamicLayer which is using proxy beacuse service is not CORS enabled

urlUtils.addProxyRule({
urlPrefix: "nassgeodata.gmu.edu",
proxyUrl: "/tunnel"
});
var CropScapeLayer = w.BaseDynamicLayer.createSubclass({

properties: {
mapUrl: "https://nassgeodata.gmu.edu/CropScapeService/wms_cdlall.cgi?" +
// "layers={l}" +
// "&sld={sld}" +
// "&bbox={xmin},{ymin},{xmax},{ymax}" +
// "&height={h}" +
// "&width={w}" +
"SERVICE=WMS" +
"&REQUEST=GetMap" +
"&FORMAT=image/png" +
"&TRANSPARENT=TRUE" +
"&VERSION=1.1.1" +
"&LAYERS={layers}" +
"&SRS=EPSG:4326" +
"&WIDTH={width}" +
"&HEIGHT={height}" +
"&BBOX={xmin},{ymin},{xmax},{ymax}",
mapParameters: null
},

getImageUrl: function(wmExtent, width, height) {
$scope.loading.spinner = true;
var extent = w.webMercatorUtils.webMercatorToGeographic(wmExtent);

var url = this.mapUrl
.replace("{ymin}", extent.ymin)
.replace("{xmax}", extent.xmax)
.replace("{ymax}", extent.ymax)
.replace("{xmin}", extent.xmin)
.replace("{height}", height)
.replace("{width}", width)
.replace("{layers}", this.mapParameters.layers);


return url;
},

});

 

0 Kudos
0 Replies