简体   繁体   English

Google从服务器端映射到ejs页面上

[英]Google map from server side to post on ejs page

How can you show a Google map on an ejs page when you call it from server side, I can do it directly on the index page but need to figure out how to use the data I grabbed from server side to create the markers on the map. 从服务器端调用时,如何在ejs页面上显示Google地图,我可以直接在索引页面上显示它,但需要弄清楚如何使用从服务器端获取的数据在地图上创建标记。 Tx Tx

You have to enable and use the Google Maps Embed API and make sure to have your link in an iframe div. 您必须启用并使用Google Maps Embed API ,并确保将链接放在iframe div中。 Google Maps Embed API maps are easy to add to your web page. Google Maps Embed API地图很容易添加到您的网页。 Just set the URL you build as the value of an iframe's src attribute. 只需将您构建的URL设置为iframe的src属性的值即可。 Control the size of the map with the iframe's height and width attributes. 使用iframe的heightwidth属性控制地图的大小。 No JavaScript required: 无需JavaScript:

The URL for an Google Maps Embed API request is as follows: Google Maps Embed API请求的网址如下:

https://www.google.com/maps/embed/v1/MODE?key=YOUR_API_KEY&parameters

All requests to the Google Maps Embed API must include a free API key as the value of a key parameter. 对Google Maps Embed API的所有请求都必须包含一个免费的API密钥作为key参数的值。 Your key enables you to monitor your application's Maps API usage and ensures that Google can contact you about your application if necessary. 使用密钥,您可以监视应用程序的Maps API使用情况,并确保Google可以在必要时与您联系以获取有关您的应用程序的信息。

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

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