We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8471
    • 333 Posts
    I have tried, with your modification I don’t receive the error but I see only one map!
      Sorry for my bad English grin
      • 14796
      • 59 Posts
      Hey Guys,

      Has anyone had luck removing the infoWindow?
      I have no use of it and would like it to be initially set to off.

      Also, the way this is set to geocode is by zipcode only. It doesn’t geocode the address, and that’s why the maps aren’t completely accurate in regards to zipcode. But if someone has a fix for this also, that would be greatly appreciated smiley

      Thanks,

      Josh
        • 29774
        • 386 Posts
        To remove the bubble initially delete line 148:
        marker.openInfoWindowHtml(myMarkerContent);

        To make the marker appear in an precise location, you can pass the snippet the exact longitude and latitiude of the location using lat=xxx and lng=xxx. To get these, you can fly to your location using Google Earth, then right click it to ’Get info’. But if you do this, don’t pass the snippet the zip as well, as that will overide your values.
          Snippets: GoogleMap | FileDetails | Related Plugin: SSL
          • 24292
          • 28 Posts
          The problem is where the snippet initially sets the map center at line 113.
              map.setCenter(new GLatLng('.$coord[0].','.$coord[1].'),'.$zoom.'); 

          $coord has the coordinates in order longitude, latitude so the call should be
              map.setCenter(new GLatLng('.$coord[1].','.$coord[0].'),'.$zoom.'); 


          Then you can comment out the openInfoWindowHTML line and still pass a zip as location.
            • 29774
            • 386 Posts
            I have tried, with your modification I don’t receive the error but I see only one map!

            Did you pass a different mapid for each of the maps in the snippet call? Otherwise they will both be identified as the default, ’map’, which means one would overwrite the other. Try adding &mapid=`map1` to the first call, and &mapid=`map2` to the next call, and so on. Make sure your css styles reflect this:
            #map1, #map2 { 
               /* styles defined here */ 
            }
            
              Snippets: GoogleMap | FileDetails | Related Plugin: SSL
              • 29774
              • 386 Posts
              Rachael, you’re absolutely right, well spotted!
              Updated snippet to 1.2.
                Snippets: GoogleMap | FileDetails | Related Plugin: SSL
                • 23491 ☆ A M B ☆
                • 1,056 Posts
                Really awesome stuff! I didn’t have much luck with &phmode=`1`, and the placeholders...but no worries, it is working fine for me the default way for the time being.

                Any plans on opening up the option for multiple locations?

                Simple example link:
                http://www.econym.demon.co.uk/googlemaps/examples/map9.htm

                Something like this above?

                What’s really cool about this specific example is how easy it is to plot multiple locations using the API and a static file:

                More detail here: http://www.econym.demon.co.uk/googlemaps/basic9.htm
                  Mike Reid - www.pixelchutes.com
                  MODx Ambassador / Contributor
                  [Module] MultiMedia Manager / [Module] SiteSearch / [Snippet] DocPassword / [Plugin] EditArea / We support FoxyCart
                  ________________________________
                  Where every pixel matters.
                  • 29802
                  • 36 Posts
                  I’m wanting to use a placeholder (generated from the PPP snippet) to insert postcodes into the &zip parameter so that I can include a map on each profile showing the member’s location.

                  Example:
                  &zip=`[+zip+]`


                  However, Googlemaps displays the incorrect continent!

                  The (Googlemap) snippet is receiving the correct postcode, however, when it urlencode’s it (within geocode function (bottom of snippet)), it is encoding the placeholder name, not its value:

                  Example:
                  Placeholder [+zip+] contains value: ch14nl

                  Function geocode($postcode) receives the value ch14nl (In the $postcode variable)

                  But urlencode($postcode) outputs:
                  %5B%2Bzip%2B%5D


                  I’ve tried commenting-out the urlencode line but Googlemaps still displays incorrect location.

                  It seems urlencode is interpreting the placeholder name, but not its value. (Not a urlencode problem - See next post)

                  Any ideas?

                  Running ModX v0.96

                  (I’m not sure if this is a general ModX question but as I "found" it using this snippet...)
                    • 29802
                    • 36 Posts
                    Correction

                    Hmm... I just printed out what Google returns ($haystack variable) with no urlencode, and it seems that when the script appends the postcode to (google’s) URL, it is still passing PPP’s placeholder name - [+zip+] - not its value.

                    This, despite the correct postcode value seemingly being available within the Googlemaps script... or is it?

                    It seems that when the script calls-out to Google, the placeholder value is being switched to the placeholder name, so I’m starting to think something is happening (or not) outside of the scope of the GoogleMap snippet?
                      • 15888
                      • 7 Posts
                      For anyone using mootools on the same page as the GoogleMap snippet, you will most likely have problems with the js addEvent() function in the snippet overriding anything set previously with mootools window.addEvent()

                      My fix was to delete lines 65 - 108

                      and replace lines 157-158 with:

                      window.addEvent(\’load\’,GloadMap);
                      window.addEvent(\’unload\’,GUnload);

                      Also, I found that Australian Postcodes weren’t returning anything useful, so I changed line 51 to:

                      $coord = geocode($address); // coord[0]=lng and coord[1]=lat

                      Good job on the snippet.

                      Regards,
                      Kim