Phoogle Modified Class for Google Maps

I was looking for a php class to use on Rockit.it to geo reference band, festivals, labels and other stuff.…

Novembre 9, 2009

I was looking for a php class to use on Rockit.it to geo reference band, festivals, labels and other stuff. I found a pretty good one, named Phoogle. This class is easy to connect with db or other stuff, but there isn’t support for customizing the google map markers.
So I wrote an Icon class and I’ve placed it inside the phoogle.php file, then I’ve modified the phoogle class to use my Icon class.

I’ve also addeded the javascropt Clusterer2 class found on Acme site. It helps managing thousands of markers on the same map by clustering them together when you zoom out. To incorporate this class into the php class I’ve added a property that enables the use of the clusterer2.js file.
It works great now with a lot of markers.

I’ve modified the array containg points to handle also ajax callbacks, so if there are a lot of points you don’t have to put the info html in the page but you can call an external file to retrive the html info to display in the tag. Or simply, you can customize the action on the click on the marker.

Finally, I’ve added a fullscreen GControl I’ve written that allow user to make the map fullscreen.
To use it in the php class just turn it on by setting to true the showFSbutton propertie and include the fsaddon.js and the famous prototype.js file.
To make this control works you also have to call the html element that contains the map “mapcontainer” or you have to set the “mapContainerId” properties to match your container element.
That’s all.

Example 1: (try it | source)
A map with two custom icons and uses full screen GControl to add the “Full Screen” button.

Example 2: (try it | source)
The html info window displays an html retrived when you click on the marker.

Example 3: (try it | source)
Add 2 thousands of markers and handle them without slowing down the browser. Zoom out to see clustering. The markers are shown only when your map need to show them, not when they are out.

Download rar file here.

This rar contains:

  • phoogle2.php
  • Clusterer2.js
  • fsaddon.js
  • prototype.js

Working demos:

Phoogle modified is used here and here.

Author

PHP expert. Wordpress plugin and theme developer. Father, Maker, Arduino and ESP8266 enthusiast.

Comments on “Phoogle Modified Class for Google Maps”