We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 52634
    • 60 Posts
    Hello Coroico,
    had the same problem with two different maps on the same page. Unfortunately the documentation is not clear about that fact, it suggests that it might be possible. There should be a line like "Show different views/zooms of the same map on one page" to avoid confusion.
    Anyway, as Terry and IMHO a lot of other users of your great extension, I really would like to use it for different maps on the same page. Is there any way to fix that?
    The workaround to have all markers in the map and just use different map centers and zoom levels does not work if google always calculates the barycenter of the markers. :-(
      • 42294
      • 1 Posts
      If anyone's still wondering how to have a bit more control over the gmapsinfobox snippet (like pull in multiple tv values, use a tpl chunk etc.) then you can perhaps do what i've done, which is make a new snippet, slightly customised to still REQUEST the id var, but then run that var as the resource id in a getresources call ran from within the snippet.

      so like this: ( i named mine gmapsInfoboxGR)

      <?php
      global $modx;
       
      if (isset($_REQUEST['mkrid'])) {
          $mkrid = intval(strip_tags($modx->sanitizeString($_REQUEST['mkrid'])));
          $output = $modx->runSnippet('getResources',array(
      	'resources' => $mkrid,
      	'tpl' => 'jobTPL',
      	'includeTVs' => '1',
      	'tvPrefix' => '',
      	'showHidden' => '1',
      	));
          return $output;
      }
      


      And then run this snippet on your infobox page instead of the normal one. This'll let you run any getresource parameters you like (you could even get a little crazy and start calling in 'related' items in your map or things like that) and it all seems to work well for me. This might be a bit of a sledgehammer to crack a nut, so if anyone can advise a better solution then i'd love to hear it. I'm no hardcore coder but i seem to have a bit of a knack for fixing problems with the tools at my disposal..its not always so elegant though!

      Note that if you're using a 'blank' template, then you might need to set the <base> href in order for things to show. Also the way ive set up my params is unique to my need, remember you may need/or-not-need a tvprefix etc.

      hope it helps somebody,

      cheers,
      Dave. [ed. note: sqinnybuild last edited this post 13 years, 9 months ago.]
        • 38705
        • 101 Posts
        Hi Coroico,
        Thanx for this nice add-on

        Is it possible to do marker clustering? Couldnt find anything in your documentation.
          Addict since 2012....
          • 34004
          • 125 Posts
          Mintnl, if you need to do some advanced marker clustering with many many markers, it might make sense to have a look at CartoDB and change data through the API instead of having a lot of resources with lat, long TV attached to them. http://cartodb.com/

          You can customise the style of the maps to the nth degree using their CSS-like styling language. http://developers.cartodb.com/documentation/using-cartodb.html#section-4

          That said, clustering would be most welcome =)
            • 42420
            • 1 Posts
            Hi Coroico,
            Thanx for great work.

            One suggestion for comma-dot problem:

            line 75 gmaps.class.php

            // set latitude and longitude org
            $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';
            


            // set latitude and longitude fixed
            $lat = number_format((float) $latLng[0],8,'.','');
            $cfg['lat'] = (($lat >= -90.) && ($lat <= 90.)) ? $lat : '46.538362';
            $lng = number_format((float) (isset($latLng[1]) ? $latLng[1] : '2.427753'),8,'.','');
            $cfg['lng'] = (($lng >= -180.) && ($lng <= 180.)) ? $lng : '2.427753'; 



            float depends on locale, see localeconv(), decimal_poin

            cheers,
            deuter. [ed. note: deuter last edited this post 13 years, 9 months ago.]
              • 22446
              • 181 Posts
              Hello all,

              I have installed gmaps but I cannot seem to get a marker to display on my map. Here is a breakdown of what I am trying to do.

              I have a parent resource ID#:4 in which has the following gmaps call

              [[!Gmaps? &mapLatLng=`44.972571,-89.67041` &zoom=`7` &mapWidth=`100%` &mapHeight=`700px` &mkrLatLngTv=`mkrLatLng` &markers=`[[!GetIds? &ids=`c[[*id]]`]]`]]


              Under the parent resource I have a child resource ID#:7

              In the child resource I have the TV mkrLatLng filled out with the latitude and longitude.

              If I view the parent resource, ID#:4, the map displays and zoomed to the correct level but there is no marker. It's as if the mkrLatLng coordinates are not working. At this point I am just trying to get this to work properly. Just looking for a marker on the map. Please help.

              Thank you in advance.
                • 40024
                • 72 Posts
                Hi! This seems a very good component but i would like to know if a fuctionality such as this could be implemented before i installed and tried to configure it:

                A page will contain a map and an address textbox where if the user types his address, a marker will be created in the map. Thanks smiley
                  • 43571
                  • 2 Posts
                  Hi,

                  I just wanted to ask, if is it possible to disable the zooming of the map on mouse wheel scrolling? I don't like when you scroll down the page, and when your mouse cursor comes over the map, it zooms the area of the map instead of scrolling the page further down, and i would like to disable that.
                    • 44082
                    • 1 Posts
                    Refugee4life - you can disable mouse wheel scrolling by adding this line of code in gmaps.class.php
                    scrollwheel: false,
                    The php file is located in core/components/gmaps/model/gmaps. Open it and find line 619 (in case you have the same version and haven't done any previous code changes). Even better - search for "var optionsMap", find where it is located and add the extra line of code I have mentioned above inside the {} . That will solve the issue.

                    P.S. I am no good at php, js and etc so there may be other better ways to disable this functionality. But this worked just fine for me.

                    Greetings
                      • 42046
                      • 436 Posts
                      I was just looking at this addon and the docs have disappeared, but the Wayback Machine had a copy, so I've attached it here.