Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find nearby hospitals using google map api and javascript

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.

like image 495
Deepu S A Avatar asked Sep 10 '13 15:09

Deepu S A


People also ask

How can I get Google Maps API area?

All you need to do is to get the map bounds and then extract (and properly use) the coordinates of the corners. Using this function calculate the length and breadth of the map and then find the area.

Is JavaScript Google Maps API free?

The Maps JavaScript API uses a pay-as-you-go pricing model. Maps JavaScript API requests generate calls to two different SKUs depending on the type of request: map loads or panoramas. JavaScript services are priced separately from JavaScript native SKUs.


1 Answers

You need to use the Places Library. In the Place Search Requests you can specify a type - which categorizes what "type" of place you are searching for. According to the Supported Place Types by Google Places API, there are hospital and health types - which would probably be your best bet to get hospitals in your search response.

like image 82
Suvi Vignarajah Avatar answered Nov 09 '22 22:11

Suvi Vignarajah