Field Types / Geolocation field
Note: You are currently reading the documentation for Bolt 3.7. Looking for the documentation for Bolt 5.2 instead?
A set of fields for easy selection of a geographic location. You can use the
given address, the latitude, longitude, and the reverse geocoded address. To
see the values that are stored, use {{ dump(page.geolocation) }}
.
Note: This field requires a `google_api_key` key to be set in the main config as well as activating the "Google Maps JavaScript API" for your project on the Google Cloud Platform Console. More info on 'How to get an API key'.
Basic Configuration:¶
location:
type: geolocation
Example usage in templates:¶
To insert a simple map from Google with a marker at the given location, use:
<img src="https://maps.googleapis.com/maps/api/staticmap?center={{ record.location.latitude }},{{ record.location.longitude }}&zoom=14&size=617x300&sensor=false&markers={{ record.location.latitude }},{{ record.location.longitude }}">
More info about these static maps, can be found in the Static Maps API V2 Developer Guide. Of course, you can use the geolocation with any mapping service you like, since latitude and longitude is a common geographic coordinate system used by many services.
Couldn't find what you were looking for? We are happy to help you in the forum, on Slack or on Github.