Select to view content in your preferred language

WMS layer type v1.6: can't get URL for Map2PDF

720
1
09-20-2010 11:50 PM
MarcelKleinmann
Emerging Contributor
Hi there,

I'm using JavaScript API version1.6.

To my map I add a WMS-Layer by dojo.declare, extending esri.layers.DynamicMapServiceLayer, like provided in the esri example "Creating a WMS layer type". This is in a jsp of a java dynamic web project.

The WMS layer is displayed in my map together with the other layers. fine.

Then I try to make a pdf from the map with all it's layers, using the map2pdf service. And the pdf is being created with all the layers - except for my wms layer! There is a MapPrinter.js in the map2pdf package, which handles the different layers of the map and prints them to the pdf. I'd like to add the wms layer using it's url.

From the MapPrinter.js I try to get the current url of the WMS layer. How can I do this? When I try to access the url by layer.url, I get back "undefined".

Can someone advise?
0 Kudos
1 Reply
MarcelKleinmann
Emerging Contributor
.
I solved it with a additional variable "wmsurl" in the jsp:


dojo.declare("my.WMS1Layer", esri.layers.DynamicMapServiceLayer, {
wmsurl: "string",
constructor: function() {
this.initialExtent = this.fullExtent = new esri.geometry.Extent(2490000,5576100,2738000,5826000,new esri.SpatialReference({"wkid":31466}));
this.spatialReference = new esri.SpatialReference({wkid:31466});
this.loaded = true;
this.onLoad(this);
},
getImageUrl: function(extent, width, height, callback) {
var params = {
...
};
callback("YOUR_URL?" + dojo.objectToQuery(params));
this.wmsurl = ("YOUR_URL?" + dojo.objectToQuery(params));
}
})

Now I can access the url by layer.wmsurl in MapPrinter.js
And the WMS content is being displayed in the pdf!

I made lot's too many thoughts for a simple solution.
0 Kudos