Integrate Bing Maps with PHP by Mingfei Yan

Microsoft provides Virtual Earth Integration Kit for PHP to integrate Bing Map Applition into PHP pages. Microsoft’s Virtual Earth is an example of an element of the Microsoft platform which can be consumed by and integrated into PHP web sites. The Virtual Earth API is exposed through a Javascript library making it straightforward to integrate into any web based application.

There are multiple choices for environment set up: Linux/Apache, Windows/Apache or Windows/IIS. Both IIS and Apache use port 80 as default port. Therefore, if you have both server running on your machine, you may want to change one of the port to avoid conflict. Also, you will need PHP 5.2 and MySql for set-up.

This demo enables user to add location point in local database and the application query the address against Windows Azure service for adding longtitude and Latitude. You can check out the demo code here. Besides pluging in the sample code package, you will also need to set up a sample database in order to run the application And below is the breakdown of the files in the Package:

  1. map.php: This file contains HTML markup to display the map, display a form for adding locations to the map and imports necessary Javascript references.
  2. maps.js: This file uses the Virtual Earth API to display locations on the map.
  3. map.css: This file is a stylesheet used to configure style settings for the map and form.
  4. returnresults.php: This file loads locations from the database to display on the map.
  5. jQuery-1.2.6.js: This is teh jQuery library.  Note that this is the version shipped with ASP.NET MVC 1.0.

Try it out and see how Bing Map could help you with your PHP application.

And here are sample good industry practice of utlizing Bing Maps:

Twilight New Moon Moive production built a movie information site that utilizing Bing map. Fans could check out story lines based on different locations. You could check out this interesting site here.

Starbucks also has a store locator page in the home page. It could help users to check out strabucks store nearby. Meanwhile, it provides social component that user could share the store information on Facebook. And you can check out the site here.

Related Posts

One Response to “Integrate Bing Maps with PHP”

  1. Panadol007

    Hi, do you have any idea how can we change the red pin to any other desired gif file? And any convenient way to Add point? for ex. clicking on the map to add point instead of typing in the location now. Because by doing this, it’s not user friendly for user

    Reply

Leave a Reply