dburles / meteor-google-maps

🗺 Meteor package for the Google Maps Javascript API v3
https://atmospherejs.com/dburles/google-maps
MIT License
196 stars 49 forks source link

googleMap template not loading #133

Closed gaillota closed 7 years ago

gaillota commented 7 years ago

Hey guys,

I'm using this package with Meteor 1.3.4.4 and I can't manage to display the map.

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

In my onRendered function:

GoogleMaps.load({
   key: Meteor.settings.public.googleApiKey
});

And the helper

mapOption() {
    if (GoogleMaps.loaded()) {
        // Map initialization options
        return {
            center: new google.maps.LatLng(-37.8136, 144.9631),
            zoom: 8
        };
    }
}

I'm guessing it's because I don't import the googleMap template but how can I do that ?

dburles commented 7 years ago

That code looks fine, without seeing the rest of the project I can't really guess too much. If you like, it would be helpful if you could put the project on github so that we can take a look. See here http://stackoverflow.com/help/mcve

gaillota commented 7 years ago

The project is on Github but I switched to Leaflet maps because I could not find a solution. However, I'm still interesting in using Google Maps and figuring out why this does not work. I will create a branch as soon as I can and let you take a look, if you have the time of course.

Thank you for your help.

maxfi commented 7 years ago

Did you set the css for <div class="map-container"> like so:

.map-container {
  width: 800px;
  max-width: 100%;
  height: 500px;
}

-- https://github.com/dburles/meteor-google-maps/blob/master/README.md#usage-overview

Without the height and width set the element will completely collapse and you won't see the map.