Search code examples
javascriptgoogle-mapsmeteorgoogle-maps-api-3meteor-blaze

Meteor google map maxZoom, minZoom and zoom level


I am using a meteor google map package and I would like to restraint the map zoom level (because I am doing a Geospatial Queries). Normaly it should be done in my mapOptions. My code looks like this: On my template I have my map

<template name="mypage">
    <div class="map-container">
      {{> googleMap name="map" options=mapOptions}}
    </div>
</template>

Then on my Javascript helper I should have my map options like this:

Template.mypage.helpers({
  mapOptions: function(){
    if(GoogleMaps.loaded()){
      return {
        center: new google.maps.LatLng(48.8520442,2.3346246),
        zoom: 13,
        maxZoom: 15
      }
    }
  }
})

Unfortunately the maxZoom seems to not work... Are they any other possibilities to restraint the zoom ?


Solution

  • Alright I found the solution, A maxZoom and a minZoom have to be declared in other to have the zoom level control. So a possible solution can look like this:

    Template.mypage.helpers({
      mapOptions: function(){
        if(GoogleMaps.loaded()){
          return {
            center: new google.maps.LatLng(48.8520442,2.3346246),
            zoom: 13,
            maxZoom: 20,
            minZoom: 13
          }
        }
      }
    })