获取纬度 &经度根据传单给出的地址 [英] get latitude & longitude as per address given for leaflet
本文介绍了获取纬度 &经度根据传单给出的地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的项目中,我使用传单来显示点.
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.
这篇关于获取纬度 &经度根据传单给出的地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文