When I save geo coordinates, Bubble appears to save as address text

Hi folks,

I have setup a geographic address field, and a text field. I am calling Google’s Geocoding API on the backend and returning geographic coordinates to both fields. But instead of saving the geographic coordinates, it saves the formatted address.

The first row I changed the API call to map the geo coordinates to a text field instead of a geographic address type mapping. This finally resulted in saving the actual lat/lon in the Debug text field, but still saved the formatted address in the Geolocation geographic address type field.

So I exported the data, and rather than exporting the lat/lon, it exported the formatted address in the Geolocation geographic address type field:

So is the data actually being stored as coordinates, or text?

If being stored as coordinates, why would an export how have the lat/lon values?

Thank you.

That would be the expectation that a field that is of type Geographic Address will be saved as a geographic address and not a number or text

If you want to save the coordinates, save them as number fields

I dove into this sometime last year, here’s what I recall. When Bubble saves an address, it saves some sort of object (Google Geocoding API?). When you convert an address to a string, it will use one of those fields as a simple string. If you want to save the lat lon, you have to explicitly set it.

I didn’t try to export the data, but it looks like Bubble is hiding the complexity from you and just giving you the formatted address.

1 Like

Thanks for the replies. Since I set my Geographic Address field using concatenated latitude,longitude values, I assumed that’s how it is stored.

I’ll break them out into their own fields as well.

Thanks for the advice.

1 Like

Yes indeed to save longitude & latitude, you’ll need to save them as 2 numeric fields

@ahmed.elkaffas @rico.trevisan @boston85719 I locate the longitude and latitude, I put them in CS, display them in text but when saving them (change to thing) it does not work even though I see these values ​​on the debugger. I have been looking for hours to find out why.

Would you please show us your setup for these 2 fields and what are you trying to do ?
Are they stored as “number” in your database ?