doublesecretagency / craft-googlemaps

Google Maps plugin for Craft CMS - Maps in minutes. Powered by the Google Maps API.
https://plugins.doublesecretagency.com/google-maps/
Other
10 stars 8 forks source link

Disable markers for static maps (and only center) #66

Closed jimirobaer closed 1 year ago

jimirobaer commented 1 year ago

Working on a detail page for a real estate agency. We have our own custom (HTML) marker floating above the static map.

I've tried several things, but it doesn't seem possible to create a map without markers. Static Maps can be generated without markers through the URL by only passing a 'center' parameter. It does not seem possible to do so using the Twig function googleMaps.img however.

Am I missing something, or is this something that is not possible right now?

lindseydiloreto commented 1 year ago

Hi Jimi, sorry for the late response. Yes, you definitely can create a static map without markers.

Simply pass an empty array of locations. You must specify both the center and zoom values for it to work as expected.

{% set map = googleMaps.img([], {
    'zoom': 11,
    'center': {
        'lat': 34.052235,
        'lng': -118.243683
    }
}) %}

Hope that helps!