We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 5811
    • 1,717 Posts

    I’d love to see an address locator
    grin

    Gmaps code is nearly ready to set up any kind of "stuff" locator.

    My next step is a demo with a search form regarding "volcanoes" and as results the list of volcanoes but also the markers on the map.
    And in a second step to add a "find location nearby a point" function to simpleSearch or advSearch. And integrate these search add-on with gmaps.

    I would like also synchronise the pagination of posts with the display of set of makers on a map.

      • 26422
      • 107 Posts

      So on your server create a folder named "kml" under assets/files/ , replace .txt extension of your file by .kml extension and put your kml file inside the assets/files/kml/ folder.

      By using &kml=`Weeladdie3.kml` Gmaps will find it.

      Thanks, this worked. Is there a different way to choose a marker image rather than using the chunks? I have many marker images I want to use but as it is now I would have to create a chunk for every single one. Couldn’t this be simplified maybe with just an image TV to the location of the marker image?
        Crawford Paul

        Bridgecourt Web Design - Proudly using ModX CMS
        Serving Welland, Niagara, Ontario, Canada and the world!
        http://www.bridgecourt.com
        • 5811
        • 1,717 Posts
        Couldn’t this be simplified maybe with just an image TV to the location of the marker image?
        Yes, I have anticipated this request.
        So if you put an image name until a chunk name the marker is set up from the image. e.g: set beachflag.png instead a name of a chunk and then "/assets/components/gmaps/images/beachflag.png will be used.

        Unfortunately this feature (that I completely forgotten) has a bug. So find enclosed a patch, the gmaps.class.php.zip file corrected. Drop this file under core/components/gmaps/model/gmaps/ folder.
        But has this file is not packaged with the original package, you should always applied it after an installation.
        The feature (and his correction) has been ported to release 1.1.0.

        You could see the patch in action on this demo. Look at the marker of the Réunion island. This is a simple image (without shadow) instead a complex icon. You could also see the difference inside the code of the page:
            var imgMkrs = new Array();
            imgMkrs["beachflag.png"] = new Array();
            imgMkrs["beachflag.png"]["image"] = ["beachflag.png"];
            imgMkrs["volcano"] = new Array();
            imgMkrs["volcano"]["image"] = ["beachflag.png",20,32,0,0,0,32];
            imgMkrs["volcano"]["shadow"] = ["beachflag_shadow.png",37,32,0,0,0,32];
            imgMkrs["volcano"]["shape"] = [1,1,1,20,18,20,18,1];
          • 26422
          • 107 Posts
          That’s awesome! Thanks so much for this. It works great now and is much more flexible.
            Crawford Paul

            Bridgecourt Web Design - Proudly using ModX CMS
            Serving Welland, Niagara, Ontario, Canada and the world!
            http://www.bridgecourt.com
            • 18463
            • 121 Posts
            Martijn van Turnhout Reply #85, 15 years, 4 months ago
            Hi Coroico,

            here’s my final request (I’ve finally run out of them :p): live Ajax-based filters. Check out this Google Map on http://www.vvvameland.nl/kaart-van-ameland/. The site is made with MODX as well, by the way. It’d be great to switch markers live.I can imagine this can be a bit more tricky though.
              • 26422
              • 107 Posts
              Quote from: Martijn at Jun 01, 2011, 01:32 AM

              Check out this Google Map on http://www.vvvameland.nl/kaart-van-ameland/. The site is made with MODX as well, by the way. It’d be great to switch markers live.I can imagine this can be a bit more tricky though.

              This is very cool. Would love to have more functionality than just the map bubble that pops up. Are we being too greedy? smiley Your plugin is great Coroico. Thanks for all your hard work on it.

              Is there a way to specify what coordinates the map first focuses on. I noticed in the above website that when you drag the map around there are other markers that are not in the initial view. How is that done?
                Crawford Paul

                Bridgecourt Web Design - Proudly using ModX CMS
                Serving Welland, Niagara, Ontario, Canada and the world!
                http://www.bridgecourt.com
                • 5811
                • 1,717 Posts
                greedy. Thanks, I have heard a new word laugh No, my objective is to be able to do things similar.

                Is there a way to specify what coordinates the map first focuses on.
                Yes. By providing mapLat and mapLng, you choose the central point of the map. Then when you display markers, the barycenter of the map is recalculated and the map (and the zoom) fit the bounds of the markers area. If you use a timeout like on this demo, you could see the effects. First the map is on Indonesia (13.801808,-86.334229) with a zoom=6, and then on the area delimited by the two markers (and a deeper zoom).

                I noticed in the above website that when you drag the map around there are other markers that are not in the initial view. How is that done?
                The map is fix and over the ameland island (latLng= 53.452907,5.776062 and zoom=12) and whatever the number and the position of markers, the map still stay on the same position (except if you move yourself the map). They don’t use the fitBounds function to setup the map (bounds and zoom). This is a choice. It depends of what you want.

                If we would like all the options (greedyyyyyyyyyyyyyyyy) for instance &fitBounds=`0`, this is always possible. So any suggestions are welcome.
                The only one limit (except the work to do it) is that these parameters should be understandable by everybody and the documentation "aux petits oignons" (perfect with lot of attention (in French)). So feel free to suggest what you would like.



                  • 7253
                  • 97 Posts
                  Firstly - thanks for this great snippet! In order get it to use my mkrLatLngTv - that wasn’t called mkrLatLng - I had to change line 373 of gmaps.class.php from this:

                  $placeJs .= $this->slashAndStrip($marker['mkrLatLng']) . ',';
                  


                  to this, so it would use my &mkrLatLngTv parameter’s value:

                  $placeJs .= $this->slashAndStrip($marker[$this->config['mkrLatLngTv']]) . ',';
                  
                    • 9375
                    • 5 Posts
                    Hi!
                    Great Extra for MODx.
                    Thank you Mr Coroico!
                    I think that you can scream "Cocorico". laugh


                    I use Gmaps 1.0.1 on MODx Evo.
                    I have difficulties because default Google icon doesn’t display on the map.
                    I have only one marker on a map and one map by page.


                    I’ve tested the solution of dflock but I assume that this is for Gmaps on Revo.
                    I’ve also seen the note saying that markers don’t display if "Latitude,longitude" value is wrong (improvment from 1.0.0 to 1.0.1 version).
                    But I don’t think that it’s my mistake. It isn’t so hard to put two values separated by a coma in a TV.

                    Note: I use the same values for &mapLatLng and &mkrLatLngTv.
                    But in my call I’ve tested to put &mapLatLng=[*mkrLatLng*] and it works great (TV direct reference). But the same soluce doesn’t work for &mkrLatLngTv. It doesn’t work if I put values, for example: &mkrLatLngTv=`46.7056198,6.837485499999957`

                    Then I suppose that there is a problem with the code of Gmaps.

                    Here is my call:
                    [!Gmaps?&language=`fr` &zoom=`14` &mapType=`ROADMAP` &mapWidth=`100%` &mapHeight=`450px` &scalable=`1` &mapLatLng=`[*mkrLatLng*]` &mkrLatLngTv=`mkrLatLng` &mkrClick=`none` &mkrIconTv=``!]

                    And a test page:
                    http://www.blups.ch/5000-appartement-lucens.html

                    I have made a lot of tests and now I ask for support because I can’t find the point.
                    Thank you for your help.


                    Config:
                    MODx Evo 1.0.5
                    System: Linux
                    Server API: Apache 2.0 Handler
                    PHP: 5.2.17
                    BDD MySQL Ver 14.12 Distrib 5.0.84
                    Client side: Windows 7 with IE 9, Firefox 5.0, Google Chrome 12.0.742.112, Safari 5.0.5, Opera 11.50
                      • 5811
                      • 1,717 Posts
                      dfock remark is available for evo too.

                      with Gmaps 1.0.1 for evo, Line 134 of gmaps/classes/gmaps.class.inc. php file replace
                      $placeJs .=  $this->slashAndStrip($marker['mkrLatLng']) . ',';

                      by:
                      $placeJs .=  $this->slashAndStrip($marker[$this->config['mkrLatLngTv']]) . ',';