Skip to main content
5 votes
Accepted

How to programmatically set a Smart Map address field in plugin

I figured it out, didn't realise all I had to do was pass array like so: $entry->getContent()->address = array('lat' => $lat, 'lng' => $lng, 'street1' => $street1, 'zip' => $...
Dave Coggins's user avatar
5 votes

Smart Map cluster marker

Yes, it's definitely possible to cluster your markers with Smart Map. In fact, anything that you can do with the Google Maps API can also be done with Smart Map: Manipulating the map in JavaScript I'...
Lindsey D's user avatar
  • 24k
4 votes
Accepted

How do I filter by multiple Smart Map addresses?

You would need to setup two criteria models, one for each Smart Map field, and query for the element IDs. Merge these IDs and have a 3rd criteria model where you pass in the IDs to the id parameter. ...
carlcs's user avatar
  • 36.3k
4 votes
Accepted

Adding markers to map from field in entries within section

Author of Smart Map here... It sounds like your locations are in a section (a Structure is a type of section). The first line of your solution is exactly what you'd need to get the locations value. {...
Lindsey D's user avatar
  • 24k
4 votes
Accepted

How do I talk to Smart Map in JavaScript?

I'd recommend loading your JS file after the smartmap.js file has been loaded. The smartMap JS object needs to exist before your code gets run. Try loading your JS using the includeJsFile tag... I ...
Lindsey D's user avatar
  • 24k
4 votes
Accepted

How do I differentiate between entries after merging an array?

Not sure if I totally got it but you can check the class of an object via {% if element is instance of ('craft\\elements\\Entry') %} or via switch statement {% switch className(element) %} {% ...
Robin Schambach's user avatar
4 votes
Accepted

Setting the position of a Smart Map marker on the front end

Turns out my code was pretty much working but there was another issue in there that was stopping the map marker updating. I've since resolved it. The original form is huge so here's a cut down snippet ...
foamcow's user avatar
  • 2,029
3 votes

How can I change the size of an individual pin?

Looks like there are a couple of notable errors in your JS: You have a semi-colon at the end of your icon line. That should be a comma. On the scaledSize line, you have the colon inside the quote. ...
Lindsey D's user avatar
  • 24k
3 votes

How can I add Google MarkerClusterer library to Smart Map?

UPDATE It looks like the underlying MarkerClusterer library has been moved (and theoretically improved). The new library can be found here... https://github.com/googlemaps/js-markerclustererplus Not ...
Lindsey D's user avatar
  • 24k
3 votes
Accepted

Smart Map - Setting single map with multiple pins

According to the docs, locations has to be an array of elements or an ElementCriteriaModel if you want to display multiple markers. {% set mapEntries = craft.entries.section('markets') %} {{ craft....
carlcs's user avatar
  • 36.3k
3 votes
Accepted

Getting unique values from Smart Map addresses

You'd actually need to retrieve all of the entries to count them in this way. Once you've got the complete collection, it would simply be a matter of looping through them and adding everything up. 1. ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Filter locations by zip in Smart Map

This turned out to be an issue with a misconfigured Google API key. When setting up your Google API keys, make sure that: Your domain is whitelisted (including any staging servers). Your keys have ...
Lindsey D's user avatar
  • 24k
2 votes

Adding markers to map from field in entries within section

I fiddled around with some fields and got this working. Not sure it's the most direct way, but hey. Progress is progress :) {% set locations = craft.entries.section('locations').limit(null) %} {# ...
Josh Kennedy's user avatar
2 votes
Accepted

High amount of API calls from Smart Map

Drawing the map is multiple API calls. And interacting with the map uses additional API calls. I opened the Inspector (in Firefox here), and you can see a ton of calls to maps.google.com - see all the ...
SamC's user avatar
  • 482
2 votes
Accepted

Smart Map - setting an icon size

As of Smart Map v2.4.2, it is now possible to build more elaborate markers using a nested syntax for the markerOptions value. Try something like this... {% set options = { zoom: 6, markerOptions: {...
Lindsey D's user avatar
  • 24k
2 votes

Smart Map with linked SVG icons for markers

Turns out, there was a bug in Smart Map which made this impossible. Fortunately, it's now fixed! As of Smart Map v2.4.2, it is possible to build more elaborate markers using a nested syntax for the ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Smart Map - Output map locations from relationship file in a matrix

At a glance, your code looks perfect... but I think there's a subtle error. The locations parameter can be an array of elements, but you are building an array of Address fields (which is not valid). ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Smart Map - Outputting locations from a Matrix field for all entries within a single section

Great question! While seemingly tricky, the solution to this should be relatively simple... Per the documentation, the locations parameter can come in a variety of different forms. But the one we're ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Making the Smart Map field translatable

Smart Map doesn't currently support the ability to make an Address translatable. It's on the feature request list, and will be implemented at some point in the future. In the meantime, you can use ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

How do I add styles or a theme to a Smart Map map?

You'll need to add the styling via JavaScript... smartMap.map['smartmap-mapcanvas-1'].setOptions({styles: styles}); This can't currently be done in Twig, although I may explore that option in the ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Smart Map - How to search by a field in address?

It's more "filtering" than "searching", but take a look at this... Filtering entries by subfield value Set a filter parameter when creating your element criteria model... {% set ...
Lindsey D's user avatar
  • 24k
2 votes

Visitor array has empty values with Smart Map plugin (using MaxMind)

Was using the MaxMind free trial and I didn't have the Web Service set correctly in the Smart Map plugin settings. It needed to be set to GeoIP2 City.
Brian Larson's user avatar
2 votes
Accepted

Trigger Info window in Smart Map using external navigation

When conducting a proximity search, it's common practice to display a list of nearest locations, alongside a map displaying markers of nearest locations. You may want each marker's info bubble to open ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Set OrderBy on Grouped Query Involving Smart Map Field

Okay, I've been able to solve this and figured I'd share what I discovered. The key for each group is the value of the state so really what I was after here was a key sort and just didn't realize it. ...
Tim Knight's user avatar
  • 1,022
2 votes

Invalid KML file using Smart Map Plugin

I like where you're going with this, but what you're trying to do isn't possible (yet). As it currently stands, you need to use an Asset as the kmlFile parameter... https://plugins.doublesecretagency....
Lindsey D's user avatar
  • 24k
2 votes
Accepted

Google Maps plugin - How to trigger an info window

As of Google Maps 4.0.1, there is a new getInfoWindow method in JavaScript. This makes it easy to retrieve and manipulate existing info windows. Additionally, I've written a guide for Opening Info ...
Lindsey D's user avatar
  • 24k
2 votes
Accepted

FeedMe + Google Maps plugin Address fields missing

Good news! The two plugins are now fully compatible as of Feed Me v4.3.6. Update to the latest version of Feed Me, and give it another shot!
Lindsey D's user avatar
  • 24k
1 vote

How can I change the size of an individual pin?

You already stated the wrong ; Aside from that, i managed to change the size in one of my projects, where i had to use a bitmap image, this way: marker[id] = new google.maps.Marker({ position: ...
phaetons's user avatar
  • 705
1 vote

How can I add Google MarkerClusterer library to Smart Map?

I don't believe Smart Map currently offers that functionality. I'd recommend opening an issue with your feature request over at https://github.com/doublesecretagency/craft-smartmap.
Jalen Davenport's user avatar
  • 3,045
1 vote

Setting Google maps circles using Smart Map plugin

This is a shot in the dark, so let me know if this does/doesn't work... Here's how you're starting your loop: $.each( smartMap.marker, function( key, value ) { And near the end, you reference a ...
Lindsey D's user avatar
  • 24k

Only top scored, non community-wiki answers of a minimum length are eligible