将Google地图的单个大型图片叠加转换为图块 [英] Convert a single large image overlay to tiles for Google Maps

查看:118
本文介绍了将Google地图的单个大型图片叠加转换为图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一张使用Google Maps v3 API覆盖的大型高分辨率图片。这对于具有合理网络连接的台式机和笔记本电脑来说效果很好,但毫不奇怪,它对移动用户来说效果不佳。



什么是最好的/最简单的方法来打破在各种缩放级别将图像上传到2D图块中,以便我可以通过API作为谷歌地图的平铺服务器?

有没有一个程序能够可靠地为我生成拼贴,并为我提供每个生成的拼贴的必要缩放比例和坐标,并且/或者给我正确的拼贴,如果我提供缩放和坐标?

一旦你收集到正确的信息,写一个磁贴服务器就可以轻松地完成它了吗?也许有源代码可以用作模型? (我在 http://blog.gmapify.fr/a-map-tile-server-part-2-understanding-google-maps-tile-overlays-and-building-up-a-tile-server 这当然是有帮助的,但它不会从源图像中提供图块,所以我不得不至少将这部分视为...)



<或者也许有一步一步的算法,我可以手动跟踪,如果更直接? (因为它只有一个图像,并且它覆盖了地图上的一个区域,可能是一平方英里,所以手动这样做也许是可行的,如果不是更好的话。)

解决方案

您可以查看MapTiler http://code.google.com/p/ maptiler / 。它可以生成你需要的瓷砖。

Tile服务器非常易于编写。最简单的方法是将静态文件(您的图块)存放在目录结构中。目录结构通常是servername / zoom / x / y.png(或zoom / y / x.png)。这种结构也是由MapTiler生成的。 MapTiler还使用这些图块生成示例网页(但我想它使用的是Google Maps API v2)。



有关在Google Maps API v3中使用图块的信息,可以找到此处: http://code.google.com/apis/maps /documentation/javascript/maptypes.html#CustomMapTypese


I have a large high-resolution image that I am using for an overlay using Google Maps v3 API. This works fine for desktop and laptop computers with a reasonable network connection, but unsurprisingly it does not work so well for mobile users.

What's the best/easiest way to break the image up into 2D tiles at the various zoom levels so I can act as a tile server for Google Maps via the API?

Is there a program that will reliably generate the tiles for me and provide me with the necessary zoom and coordinates for each resulting tile and/or give me the correct tile if I provide the zoom and coordinates?

Is it pretty easy to write a tile server to do it on the fly once you gather the right info? Perhaps there's source code out there that I can use as a model? (I found a tile server at http://blog.gmapify.fr/a-map-tile-server-part-2-understanding-google-maps-tile-overlays-and-building-up-a-tile-server which is certainly helpful, but it doesn't serve tiles from a source image, so I'd have to at least figure that part out...)

Or perhaps there is step-by-step algorithm that I can manually follow if that's more straightforward? (Since it's only one image and it covers an area on the map of maybe a square mile, manually doing it like that is perhaps feasible if not preferable.)

解决方案

you can check MapTiler http://code.google.com/p/maptiler/. It can generate the tiles you need.

Tile server is really easy to write. The easiest way is just to host static files (your tiles) in a directory structure. The directory structure is then usually servername/zoom/x/y.png (or zoom/y/x.png). Such structure is also produced by MapTiler. MapTiler also generates an example web page using the tiles (but I guess it uses Google Maps API v2).

Information about using your tiles in Google Maps API v3 can be found here: http://code.google.com/apis/maps/documentation/javascript/maptypes.html#CustomMapTypese

这篇关于将Google地图的单个大型图片叠加转换为图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆