Bubble’s Google Map Extender Plugin

Demo to preview the settings

Introduction

This plugin adds abilities to add layers, switch to 3d mode, track live, show directions, track route, display KML & more with bubble’s default map.
Note: In order to use the plugin, you'll need to place Map Element on Page and give it an ID Attribute for linking the map with Plugin Element. See below how to add an ID attribute to elements.
Image without caption

Prerequisites

You'll need to enable Directions , Places API in Google Cloud Platform For users who are setting their application place your Google Map API and Google Geocode API keys in order to you use the plugin with a Map element in the Bubble application: Settings > General tab > General services api keys.
Image without caption
💡

How to setup

I. Setting up Google Console Dashboard

II. Setting up Bubble application in page editor

  1. After you've set Google Console and app API keys, place on page Map element and Map Extender element
Image without caption
2. Assign ID attribute to map element (ex: map1) , see description above how to expose ID attribute for an element
Image without caption
3. In Map Extender element propriety Google Map ID , place the ID attribute (ex: map1) to combine both elements
Image without caption
4. Done! Start using actions, states, events and element properties within your application.

Plugin Element proprieties

The plugin contains Map Extender visual element that should be used on page.
Image without caption
Proprieties fields:
  1. Google Map ID - your google map element id.
  1. Initial Latitude - initial latitude to be used on the map.
  1. Initial Longitude - initial longitude to be used on the map.
  1. Initial Zoom - initial zoom for the map.
  1. Disable Default UI - checkbox; check it if you want to disable default Google maps UI.
  1. Map Type - dropdown; type of the map, available values: roadmap, satellite, hybrid, terrain
  1. Custom Style - (optional) custom styles to customize the map (https://snazzymaps.com). Insert the Javascript Style Array copied from the selected style page.
  1. Marker Type - marker representation from your bubble database; should contain a field of type geographic address!!!

Element Events

1. Geolocation is not supported - triggered when geolocation is not supported by the device.
2. Geolocation find is not allowed - triggered when user blocks his location tracking.
3. Directions Failed - triggered if directions failed.
4. Marker Clicked - triggered when a marker is clicked.

Element Actions

1. Get Map as URL (while tracking) - used for refreshing 'Map as URL' state.
2. Display KML File - used for displaying KML files with content.
3. Add Layer - used for adding additional layers to the map (Traffic Layer, Transit Layer, Bicycling Layer, Data Layer).
4. 3D Map - used for displaying a place from the map in 3D if the place has 3D imagery.
5. Track User - used to start tracking the current user position in real time.
6. Stop tracking user - used to stop tracking the current user position.
7. Add Directions - used for drawing best route between two points.
8. Draw Previous Route - used for drawing to the map a saved route (Mileage State).
9. Reset Map - used for resetting the map to initial conditions.
  1. Draw Previous Route - draws the previous route
11. Add Marker(s) - used to add a marker or a set of markers to the page from the database.
12. Hide/Show all markers - used to toggle markers visibility from the database.
13. Hide Layer - used to hide selected layer from the map.
  1. Remove All Geo JSON Files - used to remove all GeoJSON files from the map at once
  1. Set Geo JSON By ID - used to set the style for GeoJSON by its id (fill color, stroke color, stroke weight)
  1. Remove Geo JSON Style By ID - used to remove styles from a GeoJSON by its id
  1. Remove Geo JSON By ID - used to remove GeoJSON (by its id) from the map
  1. Add Geo JSON - used to add a GeoJSON file to the map
  1. Center Map To - center map to certain coordinates.
  1. Add List of Markers - adds a list of markers from the database.
  1. Show Marker Info - shows a popup with marker info.
  1. Close Marker Info - closes popup with marker info.
  1. Custom Marker - use to create a custom marker.
  1. Set Zoom A Map Extender- used to change the map's current zoom.
  1. Hide one marker - use to hide a single marker.
  1. Show one marker - use to display a single marker.
  1. Add Routes - used for drawing several routes.
  1. Delete Route - Delete previous route or all routes.
    1. Delete
      Available options: “Previous” and “All” Option "Previous" delete the last created route. The action can be called as many times as routes was created. Example: There was created 3 routes on a map, call this action twice to leave only the first created route.
      Dropdown options

Element States

  1. Map as URL - returns current map position as google maps url.
  1. Mileage - returns a travelled route.
  1. Directions Distance - route distance in meters.
  1. Directions Duration - route travelling time in seconds.
  1. Latitude - Tracked latitude
  1. Longitude - Tracked longitude
  1. Last Clicked Marker - the marker that was last clicked
  1. Added Geo JSON ID - id of the last Geo JSON file added by the user
  1. Hide marker id - id of the hidden marker

Workflow examples

  1. Example 'Add Directions' action settings
Image without caption
2. Example 'Track user' action settings
Image without caption
3. Example 'Add Geo JSON' action settings
Image without caption

Changelogs

Update: 11/27/2020

  1. Added Map Extender element actions:
  • Hide Layer
  • Add Geo JSON
  • Set Geo JSON Style By ID
  • Remove Geo JSON Style By ID
  • Remove Geo JSON By ID
  • Remove All Geo JSON Files - used to remove all GeoJSON files from the map at once
2. Added Map Extender element state:
  • Added Geo JSON ID
3. Added 'Data layer' option to 'Add Layer' and 'Hide Layer' Map Extender element actionsUpdate: 22/06/2021, Version 1.26.0 -
  • Fixed issue with displaying maps

Update: 24/08/2021, Version 1.30.0

  1. Added a new action "Add a list of markers" and a new option to use custom icons for this.

Update: 14/09/2021Improvement: Version: 1.31.0

  • Added description to fields in the 'Add list of markers' action.

Update: 19/10/2021, Version 1.31.0

  • Added event "map is loaded"

Update: 20/12/2021, Version 1.33.0

  1. Added new action show custom marker info popup
  • Show marker info
In this action, we can address an earlier created group (which will be a popup for displayed information). Or we can create a popup, setting the height and width of the desired popup, in which we can upload the text or HTML, to display the required information.
Image without caption
  • Close marker info
This action can be attached to any button or group, to close the displayed information popup.

Update: 12/01/2023, Version 1.37.0

  • added "Marker Popup" action

Update: 17/02/2023, Version 1.40.0

  • Added "Set Zoom" action

Update: 06/09/2023, Version 1.46.0

  • Updated action "Add list of markers".

Update: 11/09/2023, Version 1.48.0

  • Updated marker and route actions.

Update: 31/10/2023, Version 1.52.0

  • Added features left & right clicks on the map

Update 12/12/23 - Version 1.53.0

  • Fixed action "Reset Map", added action "Delete Route".

Update 03.06.24 - Version 1.54.0

  • Added "Marker size" field for actions: "Add a Marker", "Add list of markers", "Custom Marker"