Announcement Announcement Module
Collapse
No announcement yet.
Google API Maps Page Title Module
Move Remove Collapse
Search Search Module
Collapse

Advertisement Advertisement Module
Collapse

Featured Images Featured Images Module
Collapse

Mediabistro Creative Sites Mediabistro Creative Sites Module
Collapse
Latest Topics Latest Topics Module
Collapse

Advertisement Advertisement Module
Collapse

Sponsors Sponsors Module
Collapse

X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Google API Maps

    Okay... so I've been fighting for a while now to get Google maps up on my sites. I want to do it API way, I already have a key and such.
    I can get the map to show up just fine... but when I try to include a marker (the little balloon) to show the specific location of the restaurant (the websites are all dining) it doesn't seem to work.

    Any suggestions?

    Here is my code...
    </script>

    <script type="text/javascript">

    function initialize() {
    if (GBrowserIsCompatible()) {
    var map = new GMap2(document.getElementById("map_canvas"));
    var myGeographicCoordinates = new GLatLng(52.876207777, -118.08148384)
    map.addOverlay(marker);

    }
    }

    </script>

    (and of course I have the key script above this, and the div line in the body for the map, yes I have the function turned to On in body as well)
    I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

  • #2
    you need to put map.addOverlay(new GMarker(myGeographicCoordinates)); instead of map.addOverlay(marker);
    portfolio | daily image | reffee

    Comment


    • #3
      Two-Toe I'm getting excited cause now I can see the marker!!
      But it's not showing in the correct place...
      any ideas?

      <script type="text/javascript">

      function initialize() {
      if (GBrowserIsCompatible()) {
      var map = new GMap2(document.getElementById("map_canvas"));
      map.setCenter(new GLatLng(52.876207777, -118.08148384), 13);
      map.addOverlay(new GMarker(52.876207777, -118.08148384));
      }
      }

      </script>

      (sorry but I've been trouble shooting this for more than 9 hours and have just kinda realized it's over my head a bit in my ability to code in JS. So I really really really appreciate the help)
      I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

      Comment


      • #4
        how about...

        <script type="text/javascript">

        function initialize() {
        if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
        var point = new GLatLng(52.876207777, -118.08148384);
        map.setCenter(point, 13);
        map.addOverlay(new GMarker(point));
        }
        }

        </script>
        portfolio | daily image | reffee

        Comment


        • #5
          BRILLIANT!!!
          I love you. (but don't tell Bladez).
          That is awesom truly thank you!

          Now I just have to work on getting it to do the zoom in, zoom out thing. but I think I know how.
          Again thank you!!!
          I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

          Comment


          • #6
            No problem! They don't call me the jesus of google APIs around here for nothing
            portfolio | daily image | reffee

            Comment


            • #7
              Okay... new question... (do you hate me yet).
              So I have zoom working and dragging etc.
              It works in Firefox and Safari (I am on a Mac)
              But not in crappy IE... any ideas?
              I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

              Comment


              • #8
                hmm, how are you doing it? which IE version?
                portfolio | daily image | reffee

                Comment


                • #9
                  here's my code...
                  <script type="text/javascript">

                  function initialize() {
                  if (GBrowserIsCompatible()) {
                  var map = new GMap2(document.getElementById("map_canvas"));
                  var point = new GLatLng(52.876207777, -118.08148384);
                  map.setCenter(point, 14);
                  map.addOverlay(new GMarker(point));
                  map.addControl(new GSmallMapControl());

                  GEvent.addListener( map, "click", function(o,p) {
                  if ( o != null ) return;
                  if ( map.getZoomLevel() > 1 )
                  map.centerAndZoom( p, map.getZoomLevel() - 2 );
                  else if ( map.getZoomLevel() == 1 )
                  map.centerAndZoom( p, 0 );
                  });

                  }
                  }

                  </script>

                  Do I need something special for IE? (I run 5.2 on a MAC)
                  I have to test PC elsewhere cause I don't have one on the weekend...
                  I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

                  Comment


                  • #10
                    ah, i think the google maps api only supports IE 6.0+ so that's probably why.
                    portfolio | daily image | reffee

                    Comment


                    • #11
                      gotcha.
                      okay. i will just do a check on IE at a different location.
                      Thanks.
                      I'd rather be hated for who I am, than loved for who I am not. ~ Kurt Cobain

                      Comment

                       
                      home | site map | advertising/sponsorships | about us | careers | contact us | help courses | browse jobs | freelancers | events | forums | content | member benefits | reprints & permissions about | terms of use | privacy policy | Copyright © 2014 Mediabistro Inc. Mediabistro Inc. call (212) 389-2000 or email us
                      Working...
                      X