将数据或可能的 IP 地理编码到谷歌地图中
我的网站上有一个捐赠部分,我对是否可以实现以下功能感兴趣:我的网站有一个捐赠者部分,我想在其中合并一个 Google 地图,其中在所有捐赠来源的位置都放置了图钉——这些位置不必是准确的(我认为 IP 地址就可以了)。
我想知道是否可以制作一个实时显示捐赠活动的谷歌地图。如果它需要实际数据(城市、州),我可以收集这些信息,因为该网站目前是按以下方式设置的:用户选择他们想要捐赠的金额,他们点击贝宝按钮,他们通过 PayPal 提交捐款,然后重新路由到感谢页面,询问姓名、城市和州(此信息通过 mySQL 存储)。用户提供此数据并点击提交(在感谢页面上)后,它们将被重新路由到捐赠者页面...这是我想要的谷歌地图,其中的引脚代表所有捐赠者和捐赠者他们来自的城市。另外,由于数据加载在 SQL 数据库中,是否可以加载包含基于该数据的所有引脚的地图,并且仍然使用新数据进行更新(实时)?最后,我使用的是 PHP——这有什么冲突吗?
如果有人可以提供任何指示,我将非常感激。我对 Google API 有点新手,所以我不确定它的功能。我还尝试查看他们的文档和论坛,但没有发现任何非常有帮助的内容。我很感谢您的宝贵时间,也感谢您提供的任何帮助!
伊万
I have a donations section on my website and I'm interested whether the following feature is possible: I have a donors portion of the site where I'd like to incorporate a Google map which has pins placed in all the locations that donations came from--these locations dont have to be exact (IP address would work fine I think).
I was wondering whether making a Google map that displays donation activity in real-time is possible. If it requires actual data (city, state) it's possible for me to gather that information, because the website is currently set-up in the following way: a user selects the amount they would like to donate, they click the paypal button, they submit their donation via paypal, get re-routed to a thank you page that asks for a name, city and state (this info is stored via mySQL). After the user provides this data and hits submit (on the thank you page), they are re-routed to the donors page... this is where i would like to have a google map with pins representing all the people who donated and the city where they are from. Also, because the data is loaded in a SQL db, would it be possible to load the map with all the pins based in this data, and still have it update with new data too (in real-time)? Finally, I'm using PHP--any conflicts with that?
If anyone can offer any pointers I'd be so thankful. I'm a bit of a novice when it comes to Google API, so I'm not sure of the capabilities. I also tried to look at their docs and forums, but did not find anything extremely helpful. I'm grateful for your time, and I thank you for any help!
Ivan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以使用 W3C 地理定位 API 检索用户浏览器的地理位置。它非常深入,所以如果您不打算阅读,我已经包含了一些我正在使用的原型代码。它应该显示一个带有您当前浏览器位置的标记。
http://dev.w3.org/geo/api/spec-source.html
您可以将经度和纬度信息存储到数据库中,然后解析它并使用 javascript 将标记插入到谷歌地图中。
The geolocation of the user's browser can be retrieved using the W3C geolocation API. It's pretty in-depth so if you're not in for the reading I have included some prototype code I was playing with. It should show a marker with your current browser location.
http://dev.w3.org/geo/api/spec-source.html
You can store the longitude and latitude information into your database and later parse it and insert the markers into google maps with javascript.