Google Map Field : is a Strapi plugin that provides a custom field for selecting a location on Google Maps.
released April 29, 2025
npm install sbp-google-map-fieldsbp-google-map-field is a Strapi plugin that provides a custom field for selecting a location on Google Maps. It allows content editors to easily pick a location via an interactive map with a draggable marker, and automatically updates the latitude and longitude values. This plugin is built using The Strapi Design System to ensure a consistent UI and can be installed via npm or yarn.
This plugin is compatible with Strapi version 5 and above.
This plugin is published as an npm package and can be installed via either npm or yarn.
npm install sbp-google-map-fieldyarn add sbp-google-map-fieldAfter installation, ensure that the plugin is linked in your Strapi project by adding it to your config/plugins.js.
In your config/plugins.js, add the following configuration:
module.exports = ({ env }) => ({
// ... other plugin configurations
'sbp-google-map-field': {
enabled: true,
config: {
apiKey: env('GOOGLE_MAPS_API_KEY'),
}
},
});Then, in your .env file, define your Google Maps API key:
GOOGLE_MAPS_API_KEY=YOUR_GOOGLE_MAPS_API_KEYMake sure your config/middlewares.js allows loading external scripts and images from Google Maps:
module.exports = [
// ... other middlewares
{
name: 'strapi::security',
config: {
contentSecurityPolicy: {
useDefaults: true,
directives: {
'script-src': ["'self'", "'unsafe-inline'", 'https://maps.googleapis.com'],
'img-src': ["'self'", 'data:', 'blob:', 'https://maps.googleapis.com', 'https://maps.gstatic.com'],
},
},
},
},
// ... other middlewares
];Once installed and configured, you can add the Google Map custom field to any content type through the Content-Type Builder. When editing an entry, editors will see:
The custom field value is stored as a JSON object in the following format:
{
"lat": 13.701951,
"lng": 100.349673
}Share your work with the community and get it listed in the Strapi ecosystem for everyone to discover and use.
Submit
