How to insert satellite map images using cell coordinates in spreadsheets?

Hey everyone! I’m stuck trying to add satellite map images to my spreadsheet using coordinates from other cells. I want to use an API to generate these maps.

Here’s what I’ve tried:

=IMAGE("https://maps.example.com/api/v2/mapstyle/satellite/" & A2 & "," & B2 & ",15,0,45/500x500?key=MY_API_KEY")

But it’s not working. I keep getting errors about number values and text that can’t be changed to numbers. When I put the full URL in my browser (with actual coordinates), the map shows up fine.

Anyone know how to make this work? I’m not sure if it’s my formula or how I’m using the API. Thanks for any help!

I’ve been down this road before, and it can be tricky. One thing that worked for me was using the SUBSTITUTE function to replace any potential commas in your coordinate cells. Sometimes spreadsheets interpret coordinates with commas as separate values, which messes up the URL. Try this:

=IMAGE(“https://maps.example.com/api/v2/mapstyle/satellite/” & SUBSTITUTE(A2, “,”, “.”) & “,” & SUBSTITUTE(B2, “,”, “.”) & “,15,0,45/500x500?key=MY_API_KEY”)

This approach ensures that any commas in your coordinates are replaced with periods, which most APIs prefer. Also, double-check that your coordinates are in the correct format (latitude, longitude) and within the valid range for your map provider. If you’re still having issues, it might be worth reaching out to the API provider’s support team for specific guidance on formatting requests.

I’ve encountered similar issues when working with map APIs in spreadsheets. The problem likely stems from how the spreadsheet is interpreting the cell values. Try wrapping your coordinate cells in the TEXT function to ensure they’re treated as strings:

=IMAGE(“https://maps.example.com/api/v2/mapstyle/satellite/” & TEXT(A2, “0.000000”) & “,” & TEXT(B2, “0.000000”) & “,15,0,45/500x500?key=MY_API_KEY”)

This should force the coordinates to be properly formatted as text within the URL. Also, double-check that your API key is correct and that you have the necessary permissions to use the satellite imagery. If you’re still having trouble, you might need to URL encode the entire string using the ENCODEURL function, depending on your specific API requirements.

hey john, i had a similar issue. try using the CONCATENATE function instead of &. like this:

=IMAGE(CONCATENATE(“https://maps.example.com/api/v2/mapstyle/satellite/“,A2,”,“,B2,”,15,0,45/500x500?key=MY_API_KEY”))

this worked for me. good luck!