views:

286

answers:

5

Hi, I have tried to find the link or document to know how to use google map for my site. I am using php. I need code for this. Though I tried a lot to find, may be the way I tried was not correct. Can anybody suggest me the link where I can find the code for google map use.

Thanks in advance.........

+1  A: 

I would start here: Google Maps API.

Andrew Hare
Thanks Andrew !!!!!!!!!!!!!!!!
+3  A: 

Hello world for Google Maps (from the API reference):

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Google Maps JavaScript API Example</title>
    <script src="http://maps.google.com/maps?file=api&amp;amp;v=2&amp;amp;key=abcdefg&amp;sensor=true_or_false"
            type="text/javascript"></script>
    <script type="text/javascript">

    function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        map.setUIToDefault();
      }
    }

    </script>
  </head>
  <body onload="initialize()" onunload="GUnload()">
    <div id="map_canvas" style="width: 500px; height: 300px"></div>
  </body>
</html>

So you can stick this straight into a PHP file to get started. Once you have that working you can start adding your server side content to the generated file or maybe server up some XML from a separate PHP file to populate the map.

There are a whole lot of great examples here:

http://code.google.com/apis/maps/documentation/examples/index.html

Cannonade
Yep. Setting the nav stuff is trival. Just need to call map.setUIToDefault (). This gives you the fancy UI , scroll wheel zoom etc..
Cannonade
A: 

Most of the google api (and the most of others web-api aswell) are handled better by javascript or flex instead of php

I suggest you to focus on js then :)

DaNieL
A: 

awesome and fabulous in nature

cwna exam
A: 

If you're using PHP, you can definitely benefit from using a class like the new PHPGoogleMapAPI class - it's just been updated as well to use V3 of the Google Maps JS APIs.

PHPGoogleMapAPI