javascript 用于虚构视频游戏世界的 Google Maps api 自定义图块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12272119/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Google Maps api custom tiles for fictional video game world
提问by Jake Wilson
I want to use the Google Maps v3 api to generate an interactive Google Map interface that uses custom tiles for a map from a video game. The app needs to be able to zoom-in out and display the proper tiles for each zoom level as well.
我想使用 Google Maps v3 api 生成交互式 Google Map 界面,该界面使用视频游戏中的地图的自定义图块。该应用程序需要能够放大并为每个缩放级别显示适当的图块。
I'm looking for some resources or a tutorial on how to accomplish this. The Google Maps v3 API appears to only discuss using custom tiles that lay on top of the normal Google Maps tiles. That wouldn't make sense in my application since my map is for a fictional world and wouldn't line up with anything in the real world maps. Perhaps I'm just not seeing what I need in the API guide...
我正在寻找有关如何完成此操作的一些资源或教程。Google Maps v3 API 似乎只讨论使用位于普通 Google Maps 磁贴之上的自定义磁贴。这在我的应用程序中没有意义,因为我的地图用于虚构世界并且不会与现实世界地图中的任何内容对齐。也许我只是没有在 API 指南中看到我需要的东西......
回答by Chris Broadfoot
Check out the ImageMapTypeclass in the reference. There's a nifty example showing Moontiles.
查看参考中的ImageMapType类。有一个漂亮的例子展示了月亮瓷砖。
One of my favourite applications is The Internet map, the developer wrote a pretty sweet articleon how it was developed.
我最喜欢的应用程序之一是The Internet map,开发人员写了一篇关于它是如何开发的非常甜蜜的文章。
回答by Dylan
You need to either cut up your custom game map image into the appropriate file/directory structure that makes integration into Maps API easy (here's an exampleusing Photoshop and some example HTML/JS code). Or use a more friendly tool like TileMill, but this expects data in a standard spatial data format and you probably don't have your game map stored in such a format. If you can go that route, they also provide a Node.js-based server called TileServethat makes integration a cinch.
您需要将自定义游戏地图图像切割成适当的文件/目录结构,以便轻松集成到 Maps API(这里有一个使用 Photoshop的示例和一些示例 HTML/JS 代码)。或者使用更友好的工具,如TileMill,但这需要标准空间数据格式的数据,而您可能没有以这种格式存储游戏地图。如果你可以走这条路,他们还提供了一个名为TileServe的基于 Node.js 的服务器,使集成变得轻而易举。
If you are expecting a boatload of traffic, then maybe look at Google Maps Engineto host your custom game map image directly in Google's infrastructure.
如果您预计会有大量流量,那么不妨看看Google Maps Engine,将您的自定义游戏地图图像直接托管在 Google 的基础架构中。