javascript 使用纬度、经度值创建地理围栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31246170/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 13:32:11  来源:igfitidea点击:

Create Geofence using Latitude,Longitude values

javascriptjavahtmlgoogle-mapsgeofencing

提问by Sohel Khan A

I have a form where I receive the latitude,longitude values of a location.On submitting the form, I wish to create geofence in google maps of a static radius.I dont wish to draw the geofence using drawing tool directly.Can anyone suggest me a way as to how I can pass the values from the form to the map?

我有一个表格,我可以在其中接收某个位置的纬度、经度值。提交表格时,我希望在静态半径的谷歌地图中创建地理围栏。我不想直接使用绘图工具绘制地理围栏。谁能建议我关于如何将值从表单传递到地图的方法?

回答by khriskooper

As geofencing is deprecated I think it's best to use the new API.

由于不推荐使用地理围栏,我认为最好使用新的 API

I've created a Liveweave example of how to achieve something along these lines here.

我已经创建了一个 Liveweave 示例,说明如何在此处实现这些目标。

You'll have to obtain the latitude / longtitude values from the URL of page shown after submitting the form. A good way to achieve this is demonstrated here.

提交表单后,您必须从显示的页面 URL 中获取纬度/经度值。此处演示实现此目的的好方法。