get latitude amp; longitude as per address given for leaflet(获取纬度 amp;经度根据传单给出的地址)
问题描述
在我的项目中,我使用传单来显示点.
In my project I am using leaflet to display points.
我正在从我的数据库中获取地址 &想要显示该特定地址的点.
I am getting address from my database & want to show point for that particular address.
我还没有找到任何可以给我自由度的东西经度根据提供的地址.
I haven't found anything which will give me latitude & longitude as per address provided.
谁能帮我解决这个问题?
Can anyone help me on this?
推荐答案
如果你想为此使用 OpenStreetmaps,你可以简单地发出请求(使用 jquery):
If you want to use OpenStreetmaps for this, you can simply make a request (using jquery):
$.get(location.protocol + '//nominatim.openstreetmap.org/search?format=json&q='+address, function(data){
console.log(data);
});
您将获得包含(不仅)纬度和经度的 JSON 对象.
You'll get JSON objects containing (not only) lat and lon.
这篇关于获取纬度 &经度根据传单给出的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:获取纬度 &经度根据传单给出的地址
基础教程推荐
- 在 contenteditable 中精确拖放 2022-01-01
- 如何添加到目前为止的天数? 2022-01-01
- fetch 是否支持原生多文件上传? 2022-01-01
- 即使用户允许,Gmail 也会隐藏外部电子邮件图片 2022-01-01
- npm start 错误与 create-react-app 2022-01-01
- 原生拖动事件后如何获取 mouseup 事件? 2022-01-01
- Bokeh Div文本对齐 2022-01-01
- Fabric JS绘制具有活动形状的多边形 2022-01-01
- 检查 HTML5 拖放文件类型 2022-01-01
- Bootstrap 模态出现在背景下 2022-01-01
