Closed Thread
Results 1 to 9 of 9

Thread: Google Maps API

  1. #1
    organizedchaos's Avatar
    organizedchaos is offline Learning Programmer
    Join Date
    Jun 2009
    Posts
    38
    Rep Power
    0

    Google Maps API

    Anyone tried Google Maps API?

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Oct 2006
    Location
    Hendersonville, NC
    Posts
    1,700
    Blog Entries
    3
    Rep Power
    0

    Re: Google Maps API

    I have a little here and there.

    Did you have a question other than that?


  4. #3
    organizedchaos's Avatar
    organizedchaos is offline Learning Programmer
    Join Date
    Jun 2009
    Posts
    38
    Rep Power
    0

    Re: Google Maps API

    Yes! I was hoping someone can teach me how to use it. I supposed I could use this: Visualization: Map - Google Visualization API - Google Code
    but I need to be able to control the markers. I want to change the markers into circles and the circles should get bigger or smaller depending on the input (like the # of people). How do I do that?

  5. #4
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Google Maps API

    I used it for a small project once. You can learn everything you need by examples here:

    Google Maps API Examples - Google Maps API - Google Code

  6. #5
    organizedchaos's Avatar
    organizedchaos is offline Learning Programmer
    Join Date
    Jun 2009
    Posts
    38
    Rep Power
    0

    Re: Google Maps API

    Can you help me with this?

    This is the type of code I'd use:
    HTML Code:
    <html>
      <head>
        <script 
    src="http://maps.google.com/maps?file=api&v=2&key=ABCDEFG" type="text/javascript"></script>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
          google.load("visualization", "1", {packages:["map"]});
          google.setOnLoadCallback(drawMap);
          function drawMap() {
            var data = new google.visualization.DataTable();
            data.addColumn('number', 'Lat');
            data.addColumn('number', 'Lon');
            data.addColumn('string', 'Name');
            data.addRows(4);
            data.setCell(0, 0, 37.4232);
            data.setCell(0, 1, -122.0853);
            data.setCell(0, 2, 'Work');
            data.setCell(1, 0, 37.4289);
            data.setCell(1, 1, -122.1697);
            data.setCell(1, 2, 'University');
            data.setCell(2, 0, 37.6153);
            data.setCell(2, 1, -122.3900);
            data.setCell(2, 2, 'Airport');
            data.setCell(3, 0, 37.4422);
            data.setCell(3, 1, -122.1731);
            data.setCell(3, 2, 'Shopping');
    
            var map = new google.visualization.Map(document.getElementById('map_div'));
            map.draw(data, {showTip: true});
          }
        </script>
      </head>
    
      <body>
        <div id="map_div" style="width: 400px; height: 300px"></div>
      </body>
    </html>
    while this is the code for the custom markers:
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
      <head>
        <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
        <title>Google Maps JavaScript API Example: Simple Icon</title>
        <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA"
                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();
            
            // Create our "tiny" marker icon
            var blueIcon = new GIcon(G_DEFAULT_ICON);
            blueIcon.image = "http://gmaps-samples.googlecode.com/svn/trunk/markers/blue/blank.png";
    		
    		// Set up our GMarkerOptions object
    		markerOptions = { icon:blueIcon };
    
            // Add 10 markers to the map at random locations
            var bounds = map.getBounds();
            var southWest = bounds.getSouthWest();
            var northEast = bounds.getNorthEast();
            var lngSpan = northEast.lng() - southWest.lng();
            var latSpan = northEast.lat() - southWest.lat();
            for (var i = 0; i < 10; i++) {
              var latlng = new GLatLng(southWest.lat() + latSpan * Math.random(),
                                      southWest.lng() + lngSpan * Math.random());
              map.addOverlay(new GMarker(latlng, markerOptions));
            }
          }
        }
    
        </script>
      </head>
    
      <body onload="initialize()" onunload="GUnload()">
        <div id="map_canvas" style="width: 500px; height: 300px"></div>
      </body>
    </html>
    I've been trying to combine them together but to no avail. I can't make it work! I just want to replace the marker on the first code with the marker on the second code. Please help!

  7. #6
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Google Maps API

    You cant replace the red ones with the blue ones unless you go about doing it with actual markers. You can make clickable markers just like in the first ones example.


    Map Overlays - Google Maps API - Google Code
    Visualization: Table - Google Visualization API - Google Code

  8. #7
    organizedchaos's Avatar
    organizedchaos is offline Learning Programmer
    Join Date
    Jun 2009
    Posts
    38
    Rep Power
    0

    Re: Google Maps API

    You cant replace the red ones with the blue ones unless you go about doing it with actual markers.
    What do you mean by that? How do I replace it then?

  9. #8
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Google Maps API

    Go here:

    Map Overlays - Google Maps API - Google Code

    If you would like help with specific code we can do that. You could also hire me to do this for you.

  10. #9
    organizedchaos's Avatar
    organizedchaos is offline Learning Programmer
    Join Date
    Jun 2009
    Posts
    38
    Rep Power
    0

    Re: Google Maps API

    I wish I could just do that but I'm not even getting paid for this myself. Do you know of any site/example that uses more than 1 type of icon for a particular lat and lng? Like for example in every city I want the number of people and the number of animals (lol) so I'd need to use two icons but same lat and lng. Is that possible?

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Google Maps API (or alternative)
    By stowaway in forum C# Programming
    Replies: 0
    Last Post: 12-05-2010, 01:24 AM
  2. Fun when the google-maps-car passes by.
    By wim DC in forum The Lounge
    Replies: 0
    Last Post: 08-30-2010, 10:59 AM
  3. Maps
    By boosali in forum C# Programming
    Replies: 2
    Last Post: 07-19-2010, 05:11 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts