CodeIgniter Google Maps V3 API Library

CodeIgniter Library - Google Maps API

In early May 2010 I wrote a Google Maps API library for CodeIgniter. This used Version 2 of the Google API and was pretty limited.

Well, I’ve been working tirelessly over the past weeks to get a new version wrote that uses Version 3 of the API instead and I am very pleased to announce that it is now avalaible for download.

The library enables you to create a map and overlay multiple markers, polylines, polygons, rectangles, ground overlays and/or circles, all of which are fully customisable. The library also supports showing directions between two points, including the ability to show the textual directions alongside the map too, and marker clustering. The first stages of integration with the Google Places API are available for use too.

To get a copy, read the documentation or to view a demo simply follow the links below:

Download Library (Last updated 1st February 2013)

View GitHub Repository

View Documentation PDF (185kb)

View Demonstrations

The demonstrations above are basic examples of what can be achieved by using the library. I recommend you read the documentation to view a full list of configurable options.

An Introduction to using the Library (Watch on YouTube)

Library Features

  • Change the maps appearance including zoom, central position, size and control positioning.
  • Add multiple markers, ground overlays, circles, rectangles, polylines and polygons. Add them all on the same map, each with a whole host of configurable options to change the appearance and how they function.
  • Add event handlers to all items on the map. This means you can perform a custom action when, for example, a marker is dragged, or the map is clicked.
  • Too many markers? Enable marker clustering to speed up and clean up your map.
  • Geocode lookups. You don’t need to know the exact lat/long co-ordinates to center the map or add a marker. You can use a building name, an address, an area, in fact any textual location will work.
  • Javascript minimisation. Include the Jsmin.php file and minify the JS output by the library.
  • Either output the Javascript to the page or write it to a separate .js file.
  • Drawing Manager library integration
  • Add traffic, bicycling and Panoramio overlays.
  • Add directions by specifying a start and end point, as well as having the option to output the textual directions to a separate element on the page.
  • Caching of Geocode requests. Speed up the map by caching any geocode lookups made.
  • Integration with the Google Places API.
  • Support for HTML5 geocoding meaning you can center the map on a user’s location.
  • Support for use within an application using HTTPS
  • Allows you to integrate with your Google Adsense account and overlay ads on top of the map.

Upcoming Features

  • Support for KML and GeoRSS Layers
  • Support for creating multiple maps on the same page
  • Viewport Marker Management
  • Extensions to the directions integration
  • Extensions to the Google Places API integration
  • Possible integration with the Elevation API

If you have any questions, spot a bug, have any feature suggestions or would like to leave feedback please leave a comment below or drop me a line.

There is a lot of functionality to be added to this library soon so keep checking back for any progress or follow me on GitHub.

This entry was posted on 2 years ago at 2 years ago by Steve Marks+ and is filed under Javascript / jQuery, PHP, Web Development. You can follow any responses to this entry through the RSS 2.0 feed.
C'mon. Say Something...

Fear not, we won't publish this
Comments (161)
  1. Love this library, I’ve used it 4 times with Codeigniter. I would like to make the selfish suggestion of a Laravel 4 version – Biostall is to on it to have not considered this yet ;-)

  2. Khim says:

    Thanks a lot. It is very useful and good CI library. It helped me a lot on my project.

  3. Benjamin says:

    Thank you, this is a great library.
    -i’d love to see the Weather Layer added sometime.

  4. Gonçalo Sá says:

    Nevermind, the iDevice problem! You must enable geolocation services for all browsers on iPad/iPhone for it to work.

    Thank you for this awesome library! :D

  5. Robert says:

    Great! Thanks for your work and for sharing that library.

  6. Thank you so much thanks to your library, I handled all gmaps api in a day.

  7. @Bart – Are you able to provide the code that you’re using at the moment so I can help you?

  8. Bart says:

    The infowindow doesn’t seem to work for me.

  9. @Steve Marks

    Steve,

    First, thanks SO MUCH for this library. You literally saved me a few hours of work programming a map for a customer.

    Second, thanks SO MUCH for that commit that allows IDs to be put on the markers. It’s awesome!

  10. @Israel – I’ve just put a tweak live to the library that allows you to now specify a custom id for a marker. The commit can be found here:

    https://github.com/BIOSTALL/CodeIgniter-Google-Maps-V3-API-Library/commit/3780e729a760599ddd889c71acee57f567cc4b71

    Simply pass in a unique ‘id’ parameter when adding the marker and the marker will be created with the name ‘marker_your_id’.

  11. Israel says:

    Hello, one question. I need change suffix from markers, example: marker_0 instead be marker_my_id from database, it’s possible?
    I want to make a menu that clicking on links opens the corresponding infowindow, but I need to know which marker belongs.
    Thank you.