简体   繁体   English

将Google Maps API与自定义图块一起使用

[英]Using Google Maps API with custom tiles

So, basic gist is, I have my own tiles of not the real world I'd like to display with the Google Maps viewer. 因此,基本要点是,我有自己的图块,而不是我想在Google Maps Viewer中显示的真实世界。 I've found examples of how to split an existing single image into tiles for use with it, but nothing that deals with setting up your own tiler. 我已经找到了一些示例,该示例说明了如何将现有的单个图像拆分为可与之配合使用的图块,但是没有任何内容可以设置您自己的图块机。

I have map data such as this: https://dl.dropboxusercontent.com/u/44766482/superimage/index.html Which right now is just a bunch of 1600x1600 images in an html table. 我有这样的地图数据: https ://dl.dropboxusercontent.com/u/44766482/superimage/index.html现在,这只是html表中的一堆1600x1600图像。 This naive method works, but I'd like to switch to the more robust google api for better zooming and smarter streaming of the image data. 这种幼稚的方法有效,但我想切换到更强大的Google API,以更好地缩放和更智能地传输图像数据。

I've been unable to find a good example of how to generate your own tiles for the zoom levels and bring it together with some html/js. 我一直找不到一个很好的示例,说明如何为缩放级别生成自己的图块并将其与一些html / js一起使用。

If you want some more information for the goal process; 如果您需要有关目标过程的更多信息; I have a python script that can output any size tiles of the map, at any zoom level. 我有一个python脚本,可以在任何缩放级别输出地图的任意大小的图块。 I'd like to bundle those together into a google maps api website. 我想将它们捆绑到一个Google Maps API网站中。 But in my own efforts I have not found a good example or documentation of how to do that. 但是,在我自己的努力中,我没有找到一个很好的例子或说明如何执行此操作的文档。 For one, I can only find examples of how the zoom levels work for the real world map, but not for a custom one. 首先,我只能找到有关缩放比例如何在真实世界地图上工作的示例,而对于自定义地图则没有。

Edit: 编辑:

Got most things working as I want them, but I'm still confused regarding the "center" that can be set, as it's in lat and lng, which don't apply. 虽然大多数事情都可以按我的意愿工作,但是对于可设置的“中心”,我仍然感到困惑,因为它以经纬度表示,不适用。 I'd also like to set boundaries as currently it tries to load .png files outside of the maps range. 我还想设置边界,因为当前它试图加载地图范围之外的.png文件。

My current progress: https://dl.dropboxusercontent.com/u/44766482/googlemapspreview/index.html 我目前的进度: https : //dl.dropboxusercontent.com/u/44766482/googlemapspreview/index.html

I think what you are looking for is the google maps imageMapTypes: 我认为您正在寻找的是Google Maps imageMapTypes:

https://developers.google.com/maps/documentation/javascript/maptypes#ImageMapTypes https://developers.google.com/maps/documentation/javascript/maptypes#ImageMapTypes

Basically, each zoom level is the 4 lower zoom tiles combined. 基本上,每个缩放级别是4个较低的缩放图块的总和。 A Projection function can be skipped to get orthogonal mapping. 可以跳过投影功能以获得正交映射。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM