asp.net - 如何让google map API获取指定区域的餐馆

标签 asp.net javascript google-maps

到目前为止我使用 http://maps.google.com/maps/geo?q=downtown&output=csv&key=whateverthekeyis获取某个地址的经度和纬度。

function load() 
{
    if (GBrowserIsCompatible())
    { 
        map = new GMap2(document.getElementById('"mapHolderID'); 
        map.addControl(new GSmallMapControl()); 
        map.addControl(new GMapTypeControl());
        map.setCenter(new GLatLng(lattitude,longitude), 15); 
        var point=new GLatLng(lattitudelongitude);
        map.addOverlay(new GMarker(point);
    }
}

因此,如果用户进入市中心,它会将用户带到市中心。 现在我想要的是,如果用户搜索市中心餐厅,搜索结果应该指向市中心并列出市中心的所有餐厅。

有什么想法可以实现这一点吗?

最佳答案

看来您正在使用 google map API 的版本 2,因此您可以集成 LocalSearch很容易。应该像在 map 实例上调用 enableGoogleBar() 一样简单。

map = new GMap2(document.getElementById('"mapHolderID'); 
map.addControl(new GSmallMapControl()); 
map.addControl(new GMapTypeControl());
map.setCenter(new GLatLng(lattitude,longitude), 15); 
var point=new GLatLng(lattitudelongitude);
map.addOverlay(new GMarker(point);
map.enableGoogleBar(); // <- new code

关于asp.net - 如何让google map API获取指定区域的餐馆,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3194546/

相关文章:

c# - 解析正则表达式

javascript - PixiJS 消耗大量 GPU

ios - 当移动网络浏览器使用自定义 URL 启动 native iOS 应用程序时,会传递哪些元数据?

jquery - 在asp.net mvc中使用jQuery datepicker的问题

css - 在 MVC 元素中隐藏鼠标悬停的超链接

c# - 编译错误 : The type 'ASP.global_asax' exists in both DLLs

javascript - 如果选择每日(复选框),请取消选择所有其他复选框

javascript - 何时在 Chrome/Web 扩展中断开 MutationObserver 的连接?

android - 谷歌地图在 android v2.2 上不显示

javascript - Google Maps API v3 - API 脚本压缩/混淆