34612

Finding nearest schools in Google Maps for post code

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>.

Recommend

  • Retrieving From Firebase Database with multiple childs
  • Why is object not dealloc'ed when using ARC + NSZombieEnabled
  • git-svn: automatically importing/creating svn revisions as git tags
  • DataGrid show an empty row when DataTable is empty
  • Where do the App Engine service account (gserviceaccount) emails go?
  • inserting duplicate records with SQL
  • Alter Table doesn't work under MS Access 64 bit. Why?
  • GCM registration works for debug APK but not release APK
  • How to specify a multi-column UNIQUE constraint in code-first Entity Framework fluent API
  • How to sort a javascript array by date
  • ASP.NET Gridview Paging Problem
  • Google Places API - Get more than 10 photos from Details Response?
  • Android Oreo JobIntentService Keep running in background for Android 7 &below and crashing often
  • HTML checkbox form and HTTP URL
  • Connecting Google Cloud SQL with Wordpress on Google Compute Engine
  • How to make SASS put relative paths in its output
  • custom string delimiters stringtemplate-4
  • Insertion large number of Entities into SQL Server 2012 [duplicate]
  • SAVE attribute needed for Fortran variables when only the C_LOC address is returned to a C program?
  • Excel's Macro-Recorder usage
  • How to use carriage return with multiple line?
  • Jackson Parser: ignore deserializing for type mismatch
  • RectangularRangeIndicator format like triangular using dojo
  • HTML download movie download link
  • Java applet as stand-alone Windows application?
  • Updating server-side rendering client-side
  • Cross-Platform Protobuf Serialization
  • Javascript + PHP Encryption with pidCrypt
  • Weird JavaScript statement, what does it mean?
  • Jquery - Jquery Wysiwyg return html as a string
  • How to format a variable of double type
  • Revoking OAuth Access Token Results in 404 Not Found
  • SQL merge duplicate rows and join values that are different
  • How to set the response of a form post action to a iframe source?
  • Setting background image for body element in xhtml (for different monitors and resolutions)
  • need help with bizarre java.net.HttpURLConnection behavior
  • Qt: Run a script BEFORE make
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • Reading document lines to the user (python)
  • Conditional In-Line CSS for IE and Others?