You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I may be doing something wrong. My location entries have an address field.
{% set locations = craft.entries().section('locations').all() %}
{% set options = {
'id': 'my-map'
} %}
{{ mapbox.map(locations, options).tag() }}
If I query multiple entries, everything works as expected. All the markers appear and the map uses the locations as it's bounds/center.
But if I only have one result, either by filtering or setting .limit(1), the location marker appears but the map looks like it uses the default center value [0,0]. I'm guessing maybe bounds needs more than one set of location coordinates to work?
Similar happens if I have no results, either by filtering the query or by setting the locations variable to an empty array []. That's to be expected with no locations set, but then I've had no luck setting a fallback center and zoom using either the center or zoomdynamic map options or by using the zoom or center universal methods.
Maybe I'm not setting the values of those options or methods correctly. Could you possibly give me an example that works using a) just 1 location and b) no locations (an empty map but with a custom center).
Thanks in advance!
The text was updated successfully, but these errors were encountered:
I may be doing something wrong. My location entries have an address field.
If I query multiple entries, everything works as expected. All the markers appear and the map uses the locations as it's bounds/center.
But if I only have one result, either by filtering or setting
.limit(1)
, the location marker appears but the map looks like it uses the default center value[0,0]
. I'm guessing maybe bounds needs more than one set of location coordinates to work?Similar happens if I have no results, either by filtering the query or by setting the locations variable to an empty array
[]
. That's to be expected with no locations set, but then I've had no luck setting a fallback center and zoom using either thecenter
orzoom
dynamic map options or by using the zoom or center universal methods.Maybe I'm not setting the values of those options or methods correctly. Could you possibly give me an example that works using a) just 1 location and b) no locations (an empty map but with a custom center).
Thanks in advance!
The text was updated successfully, but these errors were encountered: