Forum Academy Marketplace Showcase Pricing Features

[Plugin Update 11 Mar 2020] Google Maps (bdk)

Hello @gaurav,
I would like to use the :converted to list method on the user location but don’t get that option on the “Marker list 2” field. The only option it gives me that comes close is :formatted to number.
Tried it with “Marker type = User” and “Marker type = geographical position”.
Thank you for the plugin!

1 Like

Hi @mghatiya
Can you share the link to editor so that I can take a look. I’m pretty sure there’s something off with the setup / misunderstanding about the map center pin, since its not been reported by others.
You can DM me the link with access (or preferably message via the chat @ https://thebdk.com)

Best,
Gaurav

Hi @albert.drogunov,
From the screenshot you’re using the standort’s 'formatted address. The formatted address from bubble is a text and not a location. The ‘standort’ in your screenshot is the address.
Also the marker 2 type is User so your data source should be current user converted to list.
The address field 2 should be standort.

1 Like

It was quite simple setup. Like I said, now I have used one of the marker lists for the centre pin and it is working fine.

Centre pin was pointed to another searchbox element’s value where I would change the location that I would like to go to. When the map showed first time, the centre pin very often showed at right place (taking the value from searchbox). However, whenever I edited the searchbox value, the centre pin was somewhere else.

I can try recreating in another page if you need, maybe.

Hello @gaurav,
Thank you works exactly as you described it! Do you know of a way to display the users current location in real time or every 2-5 seconds? I tried creating a workflow with “Do every 5 seconds” and setting a custom state on the map but could only get it to work by writing to the database every 5 seconds. Does the google maps bdk support this type of action?

Hi @albert.drogunov,

If its one marker i.e. the map center you can set the dynamic value of that to some group’s thing where the group has a type address. Then do every 5 seconds -> update the value of the group, which will therefore update the value provided to map… I guess you can use the same approach for a list of addresses by using a easy list etc. and using that as data source of list of markers

1 Like

Hello @gaurav,

Thank you for the help! The first approach (set map center to group’s thing) works as you described. Unfortunately I cannot use this method as it resets the whole map and all its elements including the markers.

The second approach (using the easy list from the bdk Utilities plugin) I couldn’t get to work.
Tried

  • import easy list plugin on page and set type to “geographic content” leave initial content blank
  • create RG with type “geographic address” and data source “easy list’s list” and layout “full list”
  • put text field into RG and set it to “Current cell’s geographic address”
  • create custom state for the easy list plugin with type “geographic address”, do not check “is list” field
  • create “do every 5 seconds” workflow
  • step 1: set state of element “easy list” with the easy list’s custom state created above
  • run preview

The RG group is not being populated by the current geographic position every 5 seconds. Am I missing some steps maybe?

I have found another potential issue.

Say I have a data type Shop.

Shop has “Name”, “Business Type” and “Loc”.

Loc is of data type “Locality” which has “GeoLocation” and “Locality Name”. “Geo Location” is the “Geographic Address” type of field.

Now if you want to show all the shops on the map, you can’t select the marker type as “Shop”, as the shop in itself doesn’t have the address field. So, you need to select the marker type as “Locality”, and in the source you have to give this “Search for Shops’ Loc” and then give “Geo Location” as the address field.

Now this works in native google map of Bubble, and in general in Bubble at other places, but not in BDK Map. The markers don’t show up.

Is there a way around this?

Hi @albert.drogunov,
The update to marker position would refresh the marker but it doesn’t reset the whole map…
Can you DM link to your editor so that I can take a look… getting a bit difficult to help based on text without actually seeing the setup

1 Like

Hey @mghatiya,

From what you’re describing, the data source from ‘Search for Locality’ works but ‘Search for Shops’ localities’ doesn’t work as the input. That sounds more like a bubble issue than the plugin itself, since the plugin receives the evaluated value from bubble as the input source. I’d recommend filing a bug report about this.

Also the infrastructure that bubble makes available to plugin builders is very limited vs. their own so not generally a good idea to compare plugins built by others vs. bubble. For example, plugin builders can’t show / hide input fields based on another field like bubble does.

Not just this aspect but even in general I don’t recommend this approach of ‘Search for X’s Y’ as a list because it impacts bubble app’s performance quite a bit. The way bubble works, this would mean it will have to download all those searches for X and then for each X it will download the object Y associated with it. The search for X is the faster server side search and indexing part. I personally know of apps that ended up having 3-4 seconds of slowness because of such approaches + :filtered + :unique elements expressions to lead to the Y part.

A much more elegant and robust way in my opinion is to maintain a ‘synced’ field between your Shop and Locality. This was painful to set up before but not anymore. Bubble’s recently introduced database triggers on backend workflows tab will allow you to set this up in seconds.

  1. Create a location field in shop
  2. Add a ‘Do when new Locality’s location is not old Locality’s location’ -> Make changes to associated shop’s Location field.
  3. Use this location field in shop as the search constraint when you search for shops.

This way you’re doing the syncing only on change while keeping your app fast and using least memory. Plus your Search for shops will also get indexed and be faster over time. Hope that helps.

Best,
Gaurav

Hello @gaurav ,

when using the map plugin, I got the following error :

The plugin Google Maps (bdk) / element google map (bdk) threw the following error: OwnerError Recursion when evaluating property AAO on element "Map"
    at new t (https://dhtiece9044ep.cloudfront.net/package/run_debug_js/101d6e781f6de5e82cda6736e31a3d172224fc59f73bf8ca5ffb01997b36cb35/xfalse/x9:18:514494)
    at e.evaluate_property (https://dhtiece9044ep.cloudfront.net/package/run_debug_js/101d6e781f6de5e82cda6736e31a3d172224fc59f73bf8ca5ffb01997b36cb35/xfalse/x9:18:111937) (please report this to the plugin author)

The setup of the plugin is really simple, so not sure what this error is about …

Please let me know if I can help further ?

Going by my experience, they would put the ball back in plugin developer’s court as I won’t be able to reproduce the issue in regular bubble components. So I’ll give it a pass for now.

Thanks for this tip. Yes, maybe I’ll use this technique. I do agree that it would have better performance. I do not think it is elegant though. I don’t think data duplication can be considered elegant. But yes, will have better performance. Thanks for the tip.

Hi,

I appear to be having an issue with the Maps BDK plugin:

If I want to display a list of markers and their related attributes, I can do so by using a Bubble database as a data source. However, if I try doing the same thing using an external DB query, I get the following error:
The plugin Google Maps (bdk) / element google map (bdk) threw the following error: UnexpectedError This fieldName does not exist: _id
at Object.get (https://dhtiece9044ep.cloudfront.net/package/run_debug_js/040349bff3969e2958edd30e026cf803b8c04e556a8dfd86d52ea195bf682ce3/xfalse/x9:18:468786)
at type1 (PLUGIN_Google-Maps–bdk–update–google-map–bdk–.js:218:40) (please report this to the plugin author)

This happens despite:

  • Being able to load the same SQL query result into a repeating group
  • Being able to load the same addresses from the same query from a repeating group (the side effect of this is that I can’t specify any additional parameters on a per-marker basis since the Type gets reset to Geographic address; looks like I can’t choose a repeating group as a type)
  • Being able to load the results from the same SQL query directly into Bubble’s default Maps element, and reference other parameters of each marker in workflows

Is there a way to load markers directly into BDK Maps from a workflow like there is with Bubble’s Map element, or Maps Extended? That may solve the issue.

I’d like to keep using this plugin, but as it stands, I can’t!

Hi @humanalpha,

That happens because non-data DB sources don’t have an unique id attribute assigned by bubble. This is the same reason why you won’t be able to use options sets data as well in the source data.

I’m not 100% sure, but maybe you can try adding an _id field in the response endpoint from your SQL table / api endpoint. Obviously its not very practical or seamless. However at this point the plugin is only able to use bubble provided functions (the Object.get function). If your source data has to be external SQL DB query I’m afraid this plugin won’t serve the purpose (kindly ask bubble support to unsubscribe you and give a refund referencing this message in such a scenario).

Best,
Gaurav

Understood - thanks for the quick reply! Will give your suggestion a try.

Update - the remedy you mentioned allows the BDK map to display results with all necessary attributes. However, when trying to trigger an event upon clicking a map marker (in this case, navigating to a new page), I can’t seem to pass any of the parameters associated with the map marker (i.e., other fields in the same DB entry). Plaintext values in the URL parameter portion of the navigate-to workflow do work, and displaying those same attributes on the map also works.

Furthermore, when I try to pass data directly to the next page via using the “data to send” field in the Go To Page element in the workflow, it looks like all current markers have no values / are empty. Looking at the BDK map element in the debugger seems to confirm this.

It looks like the map element has access to the information I’m trying to send in a URL parameter, but for some reason it can’t send them. Is there something that I’m missing? Thanks again for your help.