获取纬度 &经度根据传单给出的地址
在我的项目中,我使用传单来显示点.
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.
相关文章