
Question:
How can I search nearest schools for any given post code like shown in following screenshot?
<a href="http://i.imgur.com/xjrMp.png" rel="nofollow">http://i.imgur.com/xjrMp.png</a>
When I go to maps.google.com I don't see this option. Or is it only available through Google Maps API? How can I do this?
Answer1:The Places API will do something like this. See the example at <a href="https://google-developers.appspot.com/maps/documentation/javascript/examples/place-search" rel="nofollow">https://google-developers.appspot.com/maps/documentation/javascript/examples/place-search</a> and alter the code to change "store"
to "school"
(and the location
to something else, if necessary).
The example you quote probably has their own database of schools.
Answer2:Andrew is exactly right. You'll need to call in places along with your maps.
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&libraries=places"></script>
Basic setup:
var customMapType = new google.maps.StyledMapType(featureOpts, styledMapOptions);
map.mapTypes.set(MY_MAPTYPE_ID, customMapType);
// Places request
// ALL TYPES: https://developers.google.com/places/documentation/supported_types
var request = {
location: myLatLng,
radius: 500,
types: ['school']
};
This example will need some modifying when put into use.
I had to do this recently for a project of mine (sorry for the annoying polygon in this example), here is a <a href="http://jsfiddle.net/jeremyhawes/1kdd9ouo/1/" rel="nofollow">jsFiddle</a>.