[OpenLayers-Users] Is there a "LikeBing" layer out there?

Mike Purvis mike at uwmike.com
Tue Jul 13 14:16:42 EDT 2010


Oh, and just to clarify, if you want to be naughty and link it to the actual
VE tileservers, change the url line to be:

'http://ecn.t0.tiles.virtualearth.net/tiles/a${n}.jpeg?g=0<http://ecn.t0.tiles.virtualearth.net/tiles/a03022311030202132.jpeg?g=0>
'

An obvious reason to do this in the first place though, is so that you can
use an offline cache and serve the tiles from your own machine. Again,
naughty!

But totally possible.

<http://ecn.t0.tiles.virtualearth.net/tiles/a03022311030202132.jpeg?g=0>

On Tue, Jul 13, 2010 at 11:11 AM, Mike Purvis <mike at uwmike.com> wrote:

> The quadtree structure is a little wacky, but it's nice for being able to
> selectively purge your cache based on regular expressions.
>
> Anyhow, here's the working class. Bit of a hack, but it does the trick:
>
> var VELayer = OpenLayers.Class(OpenLayers.Layer.XYZ, {
>     name: "VirtualEarth",
>     attribution: "Microsoft",
>     sphericalMercator: true,
>      url: '/tiles/a${n}.jpeg',
>     CLASS_NAME: "VELayer",
>
>     getURL: function (bounds) {
>         var res = this.map.getResolution();
>         var x = Math.round((bounds.left - this.maxExtent.left) / (res *
> this.tileSize.w));
>         var y = Math.round((this.maxExtent.top - bounds.top) / (res *
> this.tileSize.h));
>         var z = this.map.getZoom();
> x = x.toString(2);
>  y = y.toString(2);
> while(x.length < z) { x = "0" + x; }
> while(y.length < z) { y = "0" + y; }
>  var n = [];
> for(var i = 0; i < z; i++) {
>   n.push((parseInt(x[i]) + parseInt(y[i]) * 2).toString());
>  }
>         var url = this.url;
>         var path = OpenLayers.String.format(url, {'n': n.join('') });
>
>         return path;
>     }
> });
>
>
>
> On Tue, Jul 13, 2010 at 10:57 AM, Stephen Woodbridge <
> woodbri at swoodbridge.com> wrote:
>
>> Right! that is not the intent here. I have clients that are moving away
>> from Bing but have apps that are built around this tile name scheme. They
>> would like to create a cache using mapserver of tiles like this for their
>> other apps. being about to browse the cache in OL makes it much easier to
>> develop, review and build web apps all using the same cache.
>>
>> The big issue I see with this is determining an appropriate directory
>> structure that maximizes tile storage in dirs so you don't have excessive
>> directory overhead and that you do not have too many files in a directory or
>> run out of inodes.
>>
>> -Steve
>>
>>
>> Andreas Hocevar wrote:
>>
>>> Mind that using Bing tiles directly is a violation of the Bing Maps terms
>>> of use.
>>>
>>> Regards,
>>> Andreas.
>>>
>>> On Jul 13, 2010, at 15:33 , Mike Purvis wrote:
>>>
>>>  Hey,
>>>>
>>>> If I want to serve the Bing tiles directly, without using the
>>>> VirtualEarth wrapper layer, has that already been coded up by anyone? I know
>>>> it's just a matter of extending Openlayers.Layer.XYZ and plugging in the
>>>> correct geturl function. It's just that Bing's tile urls are based on some
>>>> quadtree nonsense that makes it slightly more of a pain that just dropping
>>>> in the coordinates.
>>>>
>>>> Nevermind about whether it's a good idea or not—has it already been
>>>> done, or should I just do it myself?
>>>>
>>>> Thanks!
>>>>
>>>> Mike
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>
>>>
>>>
>>>
>>
>
>
> --
> http://uwmike.com
>



-- 
http://uwmike.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20100713/d0843e42/attachment.html


More information about the Users mailing list