Welcome Guest, Not a member yet? Register   Sign In
Google Maps API Version 3 Library
#1

[eluser]GKWelding[/eluser]
You can read more about this on my blog, http://www.in-the-attic.co.uk/2010/08/02...version-3/ and you can see example uses here, http://www.in-the-attic.co.uk/2010/08/03...ge-update/. I have also attached the files to this post. The actual google maps library is just a wrapper for the unofficial php class for the google mapos api so none of that work was done by me. This version of the library also includes a php js minification library too so the code that's put to the page by the class is actually minified.

Hope you guys enjoy, if you find any bugs or anything then just let me know.
#2

[eluser]GKWelding[/eluser]
out of those people that have downloaded this library does anyone have any feedback on how it could be improved?
#3

[eluser]wghenderson[/eluser]
I messed around with it last night for little while, and I really liked it. Nicely done! Tonight I plan to play with drawing polygons. My goal is to make my own golf gps for my favorite course, I'll keep you posted. Any idea what the best method for using html5 geolocation with ci and your google maps?
#4

[eluser]GKWelding[/eluser]
Unfortunately I don't, no. However, you have given em an idea for some further research and integration for the library. I'll take a look at the ASAP, keep an eye on my blog for further updates.
#5

[eluser]GKWelding[/eluser]
Quick update on the HTML 5 geolocation question. Not much I can add to the library but to do it you need to add the following javascript to your html page. I use jQuery so in jQuery I would do the following...

Code:
$(document).ready(function(){
  get_location();
});

function get_location() {
  if (Modernizr.geolocation) {
    navigator.geolocation.getCurrentPosition(register_coords);
  } else {
    // no native support; maybe try Gears?
  }
}

function register_coords(position) {
  var latitude = position.coords.latitude;
  var longitude = position.coords.longitude;
  
  // use jquery or your own preference to send the values to CI
  $.post('http://www.your_url.com/savecoords/', { latitude:latitude, longitude:longitude }, function(){
    // some optional callback
  });
}

The savecoords controller would then look like the following...

Code:
$latitude = $this->input->post('latitude');
$longitude = $this->input->post('longitude');

$this->load->library('GMap');
$this->gmap->GoogleMapAPI();

// valid types are hybrid, satellite, terrain, map
$this->gmap->setMapType('hybrid');

//Set Mobile Parameters
$this->gmap->mobile = true;
$this->gmap->width = "100%";
$this->gmap->height = "100%";

$this->gmap->addMarker($longitude,$latitude);

$this->gmap->disableSidebar();

$data['headerjs'] = $this->gmap->getHeaderJS();
$data['headermap'] = $this->gmap->getMapJS();
$data['onload'] = $this->gmap->printOnLoad();
$data['map'] = $this->gmap->printMap();

$this->load->view('template',$data);

I hope this helps you in some small way.

http://www.in-the-attic.co.uk/2010/08/20...olocation/
#6

[eluser]Unknown[/eluser]
I've downloaded the files and got them to work - great work, by the way.

But, what I want to do is access the resulting google map object using JavaScript, so users can put a marker on the map and I can get the latitude and longitude.

Looking throught the generated [removed] tags, it looks like the google map object is called "mapmap". Is this right?
#7

[eluser]GKWelding[/eluser]
the map object name is dependent on what you initialised the CI library with. I think if you do $this->gmapGoogleMapAPI(); Then for some strange reason only known to me, it does initialise 'mapmap'.
#8

[eluser]Mat-Moo[/eluser]
Nice work, easy to use for me.
#9

[eluser]GKWelding[/eluser]
Cheers, glad I finally released this now, it was sat in my development folder just gathering dust until I needed it. Same with the mailchimp library...
#10

[eluser]GKWelding[/eluser]
I'm currently working on some fixes for this library so stay tuned for an update soon.




Theme © iAndrew 2016 - Forum software by © MyBB