CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • google maps show no data
Pages: [1]

Author Topic: google maps show no data  (Read 1447 times)

BigP

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
google maps show no data
September 03, 2009, 03:24:33 am
I tried to use the mapping function, using google maps.
My key seems to work, and when i add addresses the coördinates are added.

When i try to open a map. I just get a grey google map. Any suggestions?

tnx

adixon

  • I post frequently
  • ***
  • Posts: 314
  • Karma: 19
    • Blackfly Solutions
Re: google maps show no data
September 03, 2009, 05:30:54 am
Not sure if it's related, but i get no data if i pick too many points, i think it's a google maps limitation.

If you're getting this behaviour on mapping just one point, then it's a different issue. Do you have the right google map api key in? Do you have some kind of javascript issue [e.g. have you tried it on various browsers?]

BigP

  • I post occasionally
  • **
  • Posts: 37
  • Karma: 1
Re: google maps show no data
September 03, 2009, 05:50:31 am
I have the problem even if i just try to map 1 address. Using a different browser doesn't make a difference.
I tried with another api-key but no changes. The coordinates are gathered correctly, but the map is stil grey.

This is a sample of the html code


<!-- .tpl file invoked: CRM/Contact/Form/Task/Map.tpl. Call via form.tpl if we have a form in the page. -->
    <form  action="/civicrm/contact/map" method="post" name="Map" id="Map" >



  <div><input name="qfKey" type="hidden" value="1f4ff627ddd73a3b22c69a8ffc7cf120" />
<input name="_qf_default" type="hidden" value="Map:done" />
</div>



<div class='spacer'></div>
 
  <script src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAAINBHnst38gqQpwwFO1i3vBTjLzzbOdYyX6lzFYnMNR4jlmT60RQe1E8YKSiezL6M0fJBZ1D8PvjJ_Q" type="text/javascript"></script>

 
  <script type="text/javascript">
    function initMap() {

      //<![CDATA[
      var map     = new GMap2(document.getElementById("google_map"));
      var span    = new GSize(0,0);
      var center  = new GLatLng(51.037041,3.7097371);

      map.addControl(new GLargeMapControl());
      map.addControl(new GMapTypeControl());
      map.setCenter(new GLatLng( 0, 0 ), 0 );
      var bounds = new GLatLngBounds( );
      GEvent.addListener(map, 'resize', function() { map.setCenter(bounds.getCenter()); map.checkResize(); });

      // Creates a marker whose info window displays the given number
      function createMarker(point, data) {
        var marker = new GMarker(point);

        GEvent.addListener(marker, "click", function() {
          marker.openInfoWindowHtml(data);
        });

        return marker;
      }
     
     
                 
    var data = "<a href='/civicrm/contact/view?reset=1&amp;cid=1'>Pieter Sellenslagh</a><br />Home<br />Kon. Maria Hendrikaplein 65 B<br />Komimo vzw<br />Gent, 9000<br /> Belgium<br /><br />Get Directions FROM:&nbsp;<input type=hidden id=to value='Kon. Maria Hendrikaplein 65 B, Komimo vzw, Gent, 9000,  Belgium'><input type=text id=from size=20>&nbsp;<a href=\"javascript:gpopUp();\">&raquo; Go</a>";
           
    var address = "Kon. Maria Hendrikaplein 65 B<br />Komimo vzw<br />Gent, 9000<br /> Belgium";
     
                var point = new GLatLng(51.037041,3.7097371);
          var marker = createMarker(point, data);
        map.addOverlay(marker);
        bounds.extend(point);
                  map.setZoom(map.getBoundsZoomLevel(bounds));
      map.setCenter(bounds.getCenter());
     

     //]]> 
   }

    function gpopUp() {
       var from   = document.getElementById('from').value;
       var to     = document.getElementById('to').value;   
       var URL  = "http://maps.google.com/maps?saddr=" + from + "&daddr=" + to;
       day = new Date();
       id = day.getTime();
       eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=780,height=640,left = 202,top = 100');");
    }

    if (window.addEventListener) {
        window.addEventListener("load", initMap, false);
    } else if (window.attachEvent) {
        document.attachEvent("onreadystatechange", initMap);
    }

  </script>


  <div id="google_map" style="width: 100%; height: 400px"></div>

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM (Moderator: Dave Greenberg) »
  • google maps show no data

This forum was archived on 2017-11-26.