Latitude & Longitude or Lines from Result of previous step

In the first step of my workflow, I need to get the latitude and longitude of a place. I have considered or tried the following:

  • Geographic Search box to API call. User inputs their city and state (or country) into an input form with a geographic search box that automatically suggests locations as you begin typing. When the user clicks submit, the search box entry goes to an API call to retrieve the latitude and longitude in lines 2 (latitude) and 3 (longitude) of the call result. When I do this, I can’t seem to be able to pull lines 2 and 3 and use that data to update the user profile or any other database.
  • Geographic Search box uses Google Maps API. I thought I could just pull the lat/long from the result of clicking submit, but this doesn’t seem to work. I saw something that suggested maybe my site needs to be “live” for this to work—is that true, and how do I do that without making it public?
  • Plain text box goes to API call. This seems like it would work, but I can’t seem to pull lines 2 and 3 from the result of step 1.

I don’t know if I’m just not writing the expressions in the correct order, if my Google APIs are misconfigured, or if you really can’t pull lat and long and lines from previous API call results.

Any help would be super appreciated!

When the user clicks Submit, you should just be able to get the Searchbox’s value’s longitude and latitude, no? The searchbox needs to be set to geographic location and you’ll need the Google Maps API keys in your app settings set up.

Hey Tyler, I’m trying to set up the API calls at this link: AstroApp REST APIs - Latest

This is the reason for my question about the longitude and latitude. I’m having a really hard time getting the calls to connect. I was able to get lat/long to return, but I can’t seem to get them to upload to the user database/profile so that the information can be used to make future calls in a backend workflow. Any advice?

Are you just trying to turn an address into lat and long? If so its much easier using the built in operators and location search box in Bubble once you set up your Google Maps API keys and put them in your app settings.

To add the lat and long to your database for use later, you just need latitude (number) and longitude (number) fields on the User datatype, then when the user searches and picks for some address, and they click some “Save” button, you do the Make changes to Current User action, and set latitude = Searchbox's value's latitude and repeat for longitude

If you’re keeping your AstroApp API, make sure the API call is setup as Action and not Data. Then add the action, and you should be able to do the same Make changes to Current User action, but you’ll set the fields to Result of step 1's latitude (step 1 being your API call step)