We have a standard address field in a custom object and can manually geocode an iframe into a rich text field to display the Google Street View of said address.
The challenge is that the Street View API requires lat/long geocode instead of address, so in order to automate this, we need 3 steps:
- Send the address to the Google Geocode API and wait for it to return the lat/long geocode
- Post the results as an iframe in a rich text field
The first step can be done as an HTTP request or as an API call.
The part that I am stuck on is setting it up in Knack to catch and parse the geocode response and then post the results as a variable in the rich text field.
Another option would be to trigger a request on form submit or field update and then store the geocodes in a hidden text field for use as variables below.
Here is the code that goes into the rich text field, variables in bold. This is all that would be necessary if not for the need to change the address to geocode:
<iframe width="600" height="450" frameborder="0" style="border:0;"
src="https://www.google.com/maps/embed/v1/streetview?key=[Google API Key]&location=[Latitude],[Longitude]" allowfullscreen="">