We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    Quote from: JoZ3 at Sep 13, 2011, 09:41 AM
    How can I used this same coordinates for a mark without made a tv? (check this post - https://forums.modx.com/thread/18695/gmaps---localize-your-modx-documents?page=11#dis-post-391761)


    Any solution?

    I have two template variables for &mkrLatLngTv. Tried binding them with a chunk, but they do not get processed.
      DropboxUploader -- Upload files to a Dropbox account.
      DIG -- Dynamic Image Generator
      gus -- Google URL Shortener
      makeQR -- Uses google chart api to make QR codes.
      MODxTweeter -- Update your twitter status on publish.
      • 36426
      • 197 Posts
      Hi has Gmaps recently broken for anyone else? At first I thought it was just my site, but then when I went to the demo site http://www.revo.wangba.fr/ the info boxes are also not appearing any more just like they don't on my site?

      I just wondered if something has changed or browser updates have broken things? Or something google have done with the javascript??

      Or is it just me!! Probably is!! Thanks for any help.,,
        Yorkshire UK based hosting provider: https://www.simulant.uk
        • 24731 ☆ A M B ☆
        • 211 Posts
        I recently installed this and noticed my coordenates were being changed from:

        46.538362 , 2.42775

        to:

        46,538362 , 2,42775

        This of course would not render the form properly.

        Going through the code I found this:

                $lat = (float) $latLng[0];
        
                $cfg['lat'] = (($lat >= -90.) && ($lat <= 90.)) ? $lat : '46.538362';
        
                $lng = (float) (isset($latLng[1]) ? $latLng[1] : '2.427753');
        
                $cfg['lng'] = (($lng >= -180.) && ($lng <= 180.)) ? $lng : '2.427753';


        I changed to:

                $lat = $latLng[0];
        
                $cfg['lat'] = (($lat >= -90.) && ($lat <= 90.)) ? $lat : '46.538362';
        
                $lng = (isset($latLng[1]) ? $latLng[1] : '2.427753');
        
                $cfg['lng'] = (($lng >= -180.) && ($lng <= 180.)) ? $lng : '2.427753';


        So I basically removed the (float). Then it was all working correctly.

        I'm not entirely sure what the purpose of the float is.

        Regards,
        Jose R. Lopez
          • 24731 ☆ A M B ☆
          • 211 Posts
          I'm not sure if this is due to me using Friedly urls and friendly alies but the infobox when I click the marker is returning a 404 (page not found). I'm having a hard time trying to fix it.

          Any hints?
            • 24731 ☆ A M B ☆
            • 211 Posts
            Ok I think I found the problem. In file:

            gmaps.class.php

            Here is the block:

                if ( mkrid > 0){
            
                    var params = "id="+ibid+"&mkrid="+mkrid;
            
                    xmlHttp.open("POST","index.php",true);
            
                    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            
                    xmlHttp.setRequestHeader("Content-length", params.length);
            
                    xmlHttp.setRequestHeader("Connection", "close");
            
                    xmlHttp.send(params);
            
                }


            The problem is the reference to the index.php file. Since I have friendly alias, I am requesting the index.php file within the directory which is of course wrong.

            I've tried several things. I tried calling index.php from root by placing /index.php but if I do, the box will not popup (not sure why), there are no JS errors.

            I also tried writting some .htaccess rules but I am either pretty bad at it or I simply could not get anything that would work.

            Any clues or ways around this?

            Thanks.

            Jose R. Lopez
              • 24731 ☆ A M B ☆
              • 211 Posts
              I was able to figure out the htaccess rule:

              RewriteCond %{QUERY_STRING} id=(.*)
              RewriteRule ^(es|en)?/?(.*)$ index.php?id=%1


              However, the infobox still throws a page not found, maybe because the request in sent as POST?

              I'm having a hard time figuring this out, anyone able to help?
                • 24731 ☆ A M B ☆
                • 211 Posts
                Do not use the above .htaccess rule, it does not play nice with the manager. I ended up scratching it. My problem remains, I can't get the infobox to load up the right document.

                I appreciate any directions.
                  • 5811
                  • 1,717 Posts
                  @Jonah Naylor

                  By default Gmaps use the last (nightly) version of google maps.
                  I don't know when but it seems that Gmaps has not worked with an update of the last release. It seems now ok. So, clear your cache and you will get the last correct google release.

                  For more informations read http://code.google.com/intl/fr-FR/apis/maps/documentation/javascript/basics.html#Versioning


                  For Evo:

                  If you would like a released version, as the version 3.7, replace inside the line 120 of the gmaps/classes/gmaps.class.inc.php
                  src="http://maps.google.com/maps/api/js?sensor=false
                  by
                  src="http://maps.google.com/maps/api/js?v=3.7&sensor=false

                  For Revo:
                  Replace inside the line 359 of the core/components/gmaps/model/gmaps/gmaps.class.php
                  src="http://maps.google.com/maps/api/js?sensor=false
                  by
                  src="http://maps.google.com/maps/api/js?v=3.7&sensor=false


                  For the next release of Gmaps, I will add a parameter named gversion to simplify the specification of this google api version. [ed. note: coroico last edited this post 14 years, 10 months ago.]
                    • 24731 ☆ A M B ☆
                    • 211 Posts
                    I managed to get things working (sort off), not in an ideal matter but it shall do until someone can point me a better way.

                    Basically I simply bypassed the ajax calling of the document and instead used the infowindow to display the contents of my mkrContent tv.

                    Bellow code:

                    function initialize(){
                    
                        var centerMap = new google.maps.LatLng(' . $this->config['lat'] . ',' . $this->config['lng'] . ');
                    
                        var optionsMap = {
                    
                            zoom: ' . $this->config['zoom'] . ',
                    
                            center: centerMap,
                    
                            mapTypeId: google.maps.MapTypeId.' . $this->config['mapType'] . '
                    
                        }
                    
                        var map = new google.maps.Map(document.getElementById("'. $this->config['mapId'] .'"), optionsMap);
                    
                        setMarkers(map);


                    on gmaps.class.php file

                    I added this:

                        var markerPlace = new google.maps.Marker(marker);
                    	
                    var contentString = "'. $this->config['contentString'] .'";
                    
                    var infowindow = new google.maps.InfoWindow({
                        content: contentString,
                        position: centerMap
                    });
                    
                    google.maps.event.addListener(markerPlace, "click", function() {
                      infowindow.open(map,markerPlace);
                    });
                    
                    infowindow.open(map,markerPlace);


                    And in my snippet call, I added this:

                     &contentString=`[[*mkrContent:strip]]`


                    This works for displaying the infobox on the document, I am only using one gmaps. This probably wont work if you are doing it with multiple documents or maps at the same time as it is only using the tv from the current document.

                    I still welcome directions, I would like to continue using this snippet once it updates if it is able to be used in the matter I need.
                      • 5811
                      • 1,717 Posts
                      @redstormj

                      Apologies, but I don't follow you.
                      Could you start at the beginning and explain why the current gmaps doesn't work for you. And provide the snippet call and the platform used (Revo or Evo). Thanks.