简体   繁体   English

我可以(以及如何)在没有API的情况下使用样式化的Google地图

[英]Can I (and how to) use styled google maps without API

I am theme developer. 我是主题开发人员。 For my template I have plugin where user can set options for google map and of course generate this on template page. 对于我的模板,我有一个插件,用户可以在其中设置google map的选项,当然可以在模板页面上生成该插件。 But not everyone have google maps API key. 但并非所有人都有Google Maps API密钥。 I don't wanna demand from user his api key. 我不想要求用户提供他的api密钥。 I have also seen template written by someone else and no one wanted from user his api key. 我还看到了其他人编写的模板,没人希望用户使用他的api密钥。 So what should I do now with this? 那么我现在该怎么办?

Another question is what javascript code should I use to generate map? 另一个问题是我应该使用什么JavaScript代码生成地图? In my form I have following fields: 在我的表单中,我具有以下字段:

Map Height (px): (int) 地图高度(px):(整数)

Google Map Address 1: (eg. Wiejska 8 Warsaw) Google地图地址1 :(例如Wiejska 8 Warsaw)

Google Map Address 2: (optional) Google Map地址2 :(可选)

Google Map Address 3: (optional) Google Map地址3 :(可选)

Google Map Address 4: (optional) Google Map Address 4 :(可选)

Google Map Address 5: (optional) Google Map Address 5 :(可选)

Zoom Level: (int) 缩放等级:(整数)

Zoom Map on Mouse Wheel: (YES/NO) 鼠标滚轮上的缩放地图:(是/否)

Custom Map Style: (YES/NO) 自定义地图样式:(是/否)

Color Overlay: (eg #FFF) 颜色叠加:(例如#FFF)

Saturation: (int) 饱和度:(整数)

Lightness: (int) 亮度:(整数)

Yes, at least for now you can use Google maps without an API key. 是的,至少到目前为止,您可以使用不带API密钥的Google地图。 See Using google maps without API Keys? 请参阅使用没有API密钥的Google地图? for a discussion on the subject. 讨论这个问题。

As for what your code should look at, take a look at Google's examples . 至于您的代码应该看什么,请看一下Google的示例 Play around with them, and if you run into issues feel free to ask more specific questions. 和他们一起玩,如果您遇到问题,请随时提出更具体的问题。

Happy coding! 编码愉快!

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

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