我可以使用Google Maps API来显示自定义地图吗? [英] Can I use the Google Maps API to display a custom map?

查看:79
本文介绍了我可以使用Google Maps API来显示自定义地图吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过自定义地图,我的意思是自定义地图图块,如同映射另一个星球。我已经看了四周,但看不到任何资源指出如何在Google或任何网站上做到这一点。



我知道这是可能的,因为我见过它之前在一个网站上完成,但不幸的是,该网站链接到该网站已关闭,所以我无法到达它。

解决方案

查看 API 。这可能会帮助你加载自己的图像作为覆盖:


图像映射类型



<实现MapType作为基础地图类型可能是一项费时费力的任务。 API提供了一个特殊的类,它为大多数常用的地图类型实现了MapType接口:地图类型由包含单个图像文件的地图组成。



ImageMapType类是使用定义以下必需属性的ImageMapTypeOptions对象规范构造的:


  • tileSize(必需)指定图块的大小(类型为google.maps.Size)。 >尺寸必须是矩形,但它们不必是方形的。
  • getTileUrl(必需)指定函数,通常作为内联>函数文字提供,以处理基于提供的世界>坐标和缩放级别。



And by custom map I mean custom map tiles, as in, mapping another planet. I've looked all around but can't see to find any resources pointing how to do this on Google's or any website.

I know it's possible because I've seen it done before on a website, but unfortunately the website that has the link to THAT site is down so I can't get to it.

解决方案

Have a look at the API. This might help you by loading own images as an overlay:

Image Map Types

Implementing a MapType to act as a base map type can be a time-consuming and laborious >task. The API provides a special class that implements the MapType interface for the most >common map types: map types that consist of tiles made up of single image files.

This class, the ImageMapType class, is constructed using an ImageMapTypeOptions object specification defining the following required properties:

  • tileSize (required) specifies the size of the tile (of type google.maps.Size). >Sizes must be rectangular though they need not be square.
  • getTileUrl (required) specifies the function, usually provided as an inline >function literal, to handle selection of the proper image tile based on supplied world >coordinates and zoom level.

这篇关于我可以使用Google Maps API来显示自定义地图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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