From: Edwin C. <com...@gm...> - 2009-10-06 13:48:29
|
Hi Ricky, If getURL is not a parameter on TMSOptions and you do need it, then you could try to do it like this: TMSOptions options = new TMSOptions(); ... options.getJSObject().setProperty("getURL", "yourURL"); //the way to set properties if there is not yet a setter method or subclass TMSOptions yourself and create a setter for getURL. If it works, I would be most happy to incorporate any enhancements to TMS in the GWT-OL codebase. Greetings, Edwin P.S. I am not a TMS user but, in the example provided at the url below (tilepyramider stuff) the getURL is not specified: http://code.google.com/p/cumberland/wiki/TilePyramiderAndOpenLayers 2009/10/6 ricky chen <clo...@gm...>: > Hi Edwin, > > thank you very much for your reply. > > I am not familiar with OpenLayers in general (but am looking to use it > in place of google maps). I'll do my best to explain, please bear with > me: > > in javascript, i have an example (the generated openlayers html from > maptiler http://www.maptiler.org/) defining custom layer as > <code> > var tmsoverlay = new OpenLayers.Layer.TMS( "TMS Overlay", "", > {serviceVersion: '.', layername: '.', alpha: true, > type: 'png', getURL: overlay_getTileURL, > isBaseLayer: false}); > map.addLayer(tmsoverlay); > </code> > > notice how one of the parameters passed in is "getURL: overlay_getTileURL"? > that is actually a function defining how tile URLs are worked out > <code> > function overlay_getTileURL(bounds) { > bounds = this.adjustBounds(bounds); > var res = this.map.getResolution(); > var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * > this.tileSize.w)); > var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * > this.tileSize.h)); > var z = this.map.getZoom(); > var path = this.serviceVersion + "/" + this.layername + "/" + z + > "/" + x + "/" + y + "." + this.type; > var url = this.url; > if (mapBounds.intersectsBounds( bounds ) && z >= mapMinZoom && z <= > mapMaxZoom){ > // console.log( this.url + z + "/" + x + "/" + y + "." + this.type); > out.write(this.url + z + "/" + x + "/" + y + "." + this.type); > return this.url + z + "/" + x + "/" + y + "." + this.type; > } else { > return "http://www.maptiler.org/img/none.png"; > } > } > </code> > > so i was looking for some way to provide this tile URL logic when > experimenting with gwt-openlayers. I can see it takes an URL before > the TMSOption argument (as you've pointed out) but i'm not sure how > that URL is resolved for individual tiles? > > thanks, > ricky > > On 10/5/09, Edwin Commandeur <com...@gm...> wrote: >> Hi Ricky, >> >> I am not sure I understand the question fully ( I don't work with TMS >> layers myself ), but as far as I can see the url needs to be specified >> in the constructor of the TMS layer as a seperate argument (before the >> TMSOptions argument) >> >> Greetings, >> Edwin >> >> 2009/10/5 ricky chen <clo...@gm...>: >>> hi there, >>> >>> I have a question about defining custom URL when adding a TMS layer to >>> the map (I am emailing you guys as instructed by >>> http://sourceforge.net/projects/gwt-openlayers/support) >>> >>> when I look at general openlayers tutorial that work with custom >>> overlays, they do so by specifying an URL for getting tiles within >>> TMSOptions (a function that maps lat/lng to URL of tile), however I >>> don't see an equivalent in java class - there is TMSOptions but I'm >>> not sure how to provide a custom URL for different lat/lng. >>> >>> Are custom URLs for TMS supported by GWT Openlayers? >>> Thanks heaps, >>> Ricky >>> >> > |