1 2 3 4 Previous Next 153 Replies Latest reply: Dec 5, 2014 2:50 AM by Poshkant Sharma Go to original post RSS
      • 15. Another Google Maps Extension

        These 2 functions can be used in order to automatically center your maps and set the appropraite zoom level.   


           //Centers the map and fits the appropriate zoom




        It works by first creating the variable


        var latlngbounds = new google.maps.LatLngBounds();


        and then whilst you are handling you data you pass the lat and long values into the object to create an array of the co-ordinants.


        latlngbounds.extend(new google.maps.LatLng(lat, longi));


        Once you have that done the 2 functions at the top can be used to centre and zoom.  All you need to do is use the 2 functions outside of your data handling loop


        Its all documented in the Google Map v3 API guide




        • 16. Re: Another Google Maps Extension



          Would you be so kind to share a .js example of that? I'm still trying to get my head around javascript.

          And if somebody has a working example of how to use the onclick function, this is the furthest I got:


          google.maps.event.addListener(marker, 'click', function() {

                     this.Document.Data.SelectTextsInColumn(23, false, "value");



          I can get it working if I use an google infobox, then you click on the pin and a google infobox appears but that was the most magic I got to work.




          Edit: forget about the autocenter, I finally got it working


          The code (there are probably 10 things that could be done more efficiently):

          function Map_Done() {


                  function() {


                  //Check for existing map canvas.

                  if (this.Element.children.length == 0) {

                  var ui = document.createElement("div");


                  ui.setAttribute("style","width: 100%; height: 100%");






                  //Define Map center


                  var center = new google.maps.LatLng(50.8503396,4.3517103);

                  var latlngbounds = new google.maps.LatLngBounds();



                  //Draw map - Change options to suit your needs.

                  var Map = new google.maps.Map(document.getElementById(divName), {

                  zoom: 2,

                  center: center,

                  mapTypeId: google.maps.MapTypeId.ROADMAP


                  var markers = [];



                  //Create markers (cluster array removed, each marker is created individually).

                  for (var i = 0; i < this.Data.Rows.length; i++) {

                      var row = this.Data.Rows [i];

                      var latLng = new google.maps.LatLng(row[0].text,row[1].text);

                      var Country = row[2].text;

                      var marker = new google.maps.Marker({

                          position: latLng,

                          map: Map




                      latlngbounds.extend(new google.maps.LatLng(row[0].text,row[1].text));





                  var mcOptions = {gridSize: 15, maxZoom: 11};

                  var markerCluster = new MarkerClusterer(Map, markers, mcOptions);






                   var listener = google.maps.event.addListener(Map, "idle", function() {

                    if (Map.getZoom() > 16) Map.setZoom(16);












          • 17. Re: Another Google Maps Extension



            I took liberty of modifying the script, so it's more to what I need.



            + placemarks have Measure as tooltip

            + circles (at placemark coordinates) scaled according do Measure

            + circle color is random

            + map type is hybrid or road map (hybrid by default)

            - commented out Marker Cluster (does not work with circles added)


            What I cannot make work and I'd appreciate some help:

            1) I would like to add another measure which would be a placemark tooltip, but however I modify Definition.xml and Properties.qvpp - I can't get it working; neither adding a dimension or measure works for me.

            How are variable names defined in Properties.qvpp (where do these ".Chart.Dimension.1.Field" come from?).


            2) I tried to refactor a code a bit to be able to scale circles according to zoom level, but calling any script function from Map_Done just does not work...

            • 18. Another Google Maps Extension

              Hey, this extension is really cool but it is not working for me My guess is that we use different decimal separator (we use comma instead of point). Could it be the reasom? How can i fix it?




              • 19. Another Google Maps Extension
                Alexander Karlsson

                Nice job! Amazing that a simple proof of concept can spawn such creativity amongst the community.

                Are you running v11? The properties and definition files are alot simpler to work with from v11 and onwards.


                You should be able to call outside functions within map_done, I'll check if I can get you a working sample.

                • 20. Another Google Maps Extension

                  I'm at v11.


                  As for props + defs: I think I'll open another thread, as I cannot find a developer documentation for extensions feature (there are multiple examples, but I can't get grammar definition etc.).


                  javascript function calls: I tried to put a loop creating points+circles as separate function (basic refactoring), so I could use map resize listener to rescale circles. To my best knowledge refactoring was ok, no errors thrown, but no output either - gmaps just zooms out to "Earth" level and no points are added.




                  • 21. Another Google Maps Extension

                    @sheshele: I had the same problem. I just subsituded all the comma's for points. Not the most elegant fix but it does the trick.

                    • 22. Another Google Maps Extension

                      Boa tarde

                      É possivel criar uma rota nesta extensão?

                      conforme imagem abaixo


                      Google Tradutor


                      good afternoon
                      It is possible to create a route to this extension?
                      as the picture below



                      • 23. Another Google Maps Extension

                        Hello Alexander,


                        how can I put the balloon in this example the information infowindow

                        • 24. Another Google Maps Extension
                          Alexander Karlsson



                          Yes, you are able to specify information displayed in the pop-up when you hover a marker.

                          In the marker construct you send in a title along side your lat lng coordinates.


                          If you would like to display an information window when a marker is clicked that is also possible by calling the InfoWindow constructor for each marker in the array before you plot them.


                          Read up on the Google Maps API documentation, it's really good.

                          • 25. Another Google Maps Extension

                            I tried putting the infowindow so that when it is processed click on any marker there so it always displays the last selected still can not put in all.

                            • 26. Another Google Maps Extension
                              Alexander Karlsson

                              Sounds like you have run into a closure issue. Most likely you are attaching a infowindow that references i which will reference the last marker in the array.


                              Give me a couple of minutes and I should have a sample for you.

                              • 27. Re: Another Google Maps Extension
                                Alexander Karlsson

                                Ok, here is an updated versions that will display your expression both as title for the pin but also as an infoWindow.


                                I did not close the infowindow so if you want to close any open infowindows when a user clicks a new pin you would need to contruct your close function and call that first in the eventlistener.

                                • 28. Re: Another Google Maps Extension
                                  Alexander Karlsson

                                  egnaldoo wrote:


                                  Boa tarde

                                  É possivel criar uma rota nesta extensão?

                                  conforme imagem abaixo


                                  Google Tradutor


                                  good afternoon
                                  It is possible to create a route to this extension?
                                  as the picture below




                                  Sure, doing 2 point directions is pretty simple. However that tends to not be the case when you starting digging into the requirements.

                                  Usually you would want to plot more then two locations.


                                  IF you only want to do 2 places you can do it without extensions.

                                  The URL for directions looks like this: https://maps.google.com/maps?saddr=Englundav%C3%A4gen,+Solna,+Sverige&daddr=Scheelev%C3%A4gen+24-26,+Lund,+Sverige&hl=en


                                  Replace the saddr part (starting point) with a field in your data model that points to a full adress. Likewise for daddr that is your stop position.

                                  Would look like ='https://maps.google.com/maps?saddr=' & StartDataField & '&daddre=' & StopDataField & '&hl=en'


                                  Hook that expression up to a button as an action or embed it as a background image. Just make sure you have a calculation condition to only show routing when there is 1 available start and stop row.


                                  Same license rules from Google apply to Directions as with Maps API. Your qlikview app would need to be accessable from the internet.

                                  • 29. Another Google Maps Extension

                                    Friend worked, thank you for help was breaking my head ... add me on msn i everton_bueno_lima@hotmail.com

                                    1 2 3 4 Previous Next