Gmap3 - Forum

Gmap3 exchange platform

You are not logged in.

Ads
(server costs 27.50€ per month)


#1 2016-12-25 07:04:06

mitchellfranklin
Member
Registered: 2016-12-25
Posts: 1

Pan or re-center map after intial with KML

Hi All,

Sorry if this seems really stupid but I have tried all the examples I can find and nothing seems to work so possibly I'm doing something wrong.

I have my initial function setup to load the map with a KML layer and an initial marker which is no issue.

function loadintitalmap() {


            $('#zonemap')
                .gmap3({
                    center: [-27.278923, 153.047639],
                    zoom: 15
                })
                .kmllayer({
                    url: 'link.kml',
                    preserveViewport:true
                }).marker({
                  position: [-27.278923, 153.047639],
                  icon: 'images/marker.png'
                });


        }

But I also want to track to add a new marker and center the map to the new position, I have tried just running the above again however this does not update and some others I have placed below, could I please request some assistance with this?

//Testing adding a marker
        setTimeout(function()
        {

          /*$('#zonemap')
              .gmap3({
                  center: [-27.298923, 153.057639],
                  zoom: 15
              })
              .marker({
                position: [-27.298923, 153.057639],
                icon: 'images/marker.png'
              });*/


    $('#zonemap')
    .gmap3({
        center: [-27.298923, 153.057639],
        panTo: [48.706685,-3.486694899999975]
      }).marker({
        position: [-27.298923, 153.057639],
        icon: 'images/marker.png'
      });

//$('#zonemap').gmap3('get').panTo(new google.maps.LatLng(48.706685,-3.486694899999975))


      alert("Marked")
        }, 10000);

Offline

Ads
(server costs 27.50€ per month)


Board footer

Powered by FluxBB