I'm currently building a web feature that uses the Google Maps API, but I've found their own API documentation to be too extensive and immense. What I would like is a site with more examples or a guide or tips on methods and ways of doing things that someone experienced had found works "best". Maybe also a where-to-start and "best practice" guide.

Tips anyone?

2 answers

1
point

well ive started working with the api too lately. I read the documentation and i agree with you, its not very helpful, or at least, not very good understandable for beginners.

http://econym.org.uk/gmap/ Here you find a shitload of tutorials and examples. Also ive played around a bit with the code playground : http://code.google.com/apis/ajax/playground/#map_simple

And further more, find a site that already implements the api. here (http://s000.tinyupload.com/index.php?file_id=45215828404080357337, i uplaoded an example i made (site isnt live yet, cant show you what it does, but it does the folowing: Gets the lat and long values from a dbase via php, create a marker on that location, fill a infobox with location specific info. add a from here and to here link in the info box, when one of those links is clicked and a from/to adress is entered, the driections will appear in another div. Read trough the code, with de google documentation nearby so you can look it up.

Then in the page you want the map to load first load the google maps api, then the script that generates the map. And then you have to initialize it.

<?php echo '<script type="text/javascript" src="http://www.google.com/jsapi?key='.$GOOGLE_KEY.'"></script><br />'; ?>
<?php echo '<script type="text/javascript" src="'.base_url().'public/js/js.fn.gmap.js"></script>' ?>
<?php echo '<script type="text/javascript">
google.load("maps", "2.x");
google.setOnLoadCallback(ini);
function ini()
{
    inititalize('.$entry->latitude.','.$entry->longitude.',"'.$entry->street.'","'.$entry->house_number.'","'.$entry->postal_code.'","'.$entry->city.'","'.$entry->title.'");
    generate_map();
}

'; ?>

You HAVE TO call the setOnLoadCallback function else it wont work.

Let me know how it works out

Answered over 6 years ago by Menno Geelen
  • Thanks! I'll check it out, maybe this weekend :) Jens Hedqvist over 6 years ago
1
point

Nothing helpful here?

http://mapki.com/index.php?title=Main_Page

Answered over 6 years ago by Tony Crockford