javascript - 如何使用 google map api 和 javascript 查找附近的医院

标签 javascript html google-maps-api-3

var MapApiApplication = {
   myCurrentPosition : "",
   mapOptions : "",
   marker : "",
   initialize : function(){
      MapApiApplication.myCurrentPosition = new google.maps.LatLng(10.112293000000000000, 76.352684500000010000);
      MapApiApplication.mapOptions = {
        zoom: 13,
        center: MapApiApplication.myCurrentPosition,
        mapTypeId: google.maps.MapTypeId.ROADMAP
      };
      MapApiApplication.map = new google.maps.Map(document.getElementById('map-canvas'), MapApiApplication.mapOptions);
      MapApiApplication.marker = new google.maps.Marker({
         position: MapApiApplication.myCurrentPosition,
         map: MapApiApplication.map,
         title: 'Here You are'
      });
   }, 
}; 

I have the current position's latitude and longitude. How can i find nearby hospitals locations using only javascript and google maps api.

最佳答案

您需要使用 Places Library .在Place Search Requests您可以指定一个 type - 它对您要搜索的地点的“类型”进行分类。根据Supported Place Types by Google Places API ,有 hospitalhealth 类型 - 这可能是您在搜索响应中找到医院的最佳选择。

关于javascript - 如何使用 google map api 和 javascript 查找附近的医院,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18722477/

相关文章:

javascript - 谷歌地图未在 chrome 中显示

javascript - Google map API 未显示。 CSS错误?

javascript - 通过 JavaScript 更新 Facebook Open Graph 元标记

javascript - JavaScript 对象中不同函数声明之间的区别(如果有的话)是什么?

html - 如何让我的图像和 div 位于同一行和高度上?

python - 为什么 Shapely 无法检测给定的地理坐标点是否在 route

javascript - 从 <img> 到包含的 div 底部的距离(像素)

javascript - "Cannot read property of innerhtml null "问题

javascript - 在 html 中访问在单独的 JavaScript 文件中声明的变量

java - 如何从邮政编码获取地址?