Author Topic: Trouble Downloading Images with Google API Key  (Read 15378 times)

rhamburg

  • Newbie
  • *
  • Posts: 2
    • View Profile
Trouble Downloading Images with Google API Key
« on: March 15, 2022, 08:41:20 PM »
Hello, I am currently trying to use the CityBuilder module to download satellite images using my Google API Key. When I run the module it creates a folder of images (.png extensions), however, when I try to view them on my desktop, it says 'It appears we don't support this file type'.

Additionally, my cityBuilder.build() command fails with this error: 'UnidentifiedImageError: cannot identify image file <_io.BytesIO object at 0x000001A6BA66AEA0>'

This is my first time using a Google Maps API, so any help would be appreciated, thank you!

bacetiner

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Trouble Downloading Images with Google API Key
« Reply #1 on: March 17, 2022, 01:25:20 AM »
Thank you for using the SimCenter forum. The symptoms you described are fairly typical of the case where Google API Key is valid, but the APIs required for the current version of BRAILS are not enabled for API Key's use.

Utilizing all capabilities of the current version of BRAILS requires three APIs: 1) Street View Static API, 2) Maps Static API, and 3) Geocoding API. You will need to enable all of these APIs for the API Key you created.

The easiest way to enable these APIs is:
1) Go to https://console.cloud.google.com/
2) Select the project for which the API key was created (please see the attached image for the location of this button)
3) Locate the search bar on the top of the page (please see the attached image), enter "APIs and Services", then click the result under Products and Pages.
4) At the APIs and Services page, click on the Enable APIs and Services button, then find and select the three APIs listed above.

These steps should address the API Key issue.

One last thing, BRAILS, by default, searches your folder of images before it downloads the images required for your region. Given in your case, some of the images for your region were already erroneously downloaded, you may still run into image input issues after performing the above changes. To prevent this from happening, please 1) either manually delete the previously downloaded images your folder of images, or 2) call CityBuilder such that reDownloadImgs flag is enabled, i.e., CityBuilder(..........,reDownloadImgs = True).

I hope this helps!
« Last Edit: March 17, 2022, 01:44:05 AM by bacetiner »

rhamburg

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: Trouble Downloading Images with Google API Key
« Reply #2 on: March 18, 2022, 06:11:23 PM »
I was able to resolve my problem, thank you so much for the help!

bacetiner

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: Trouble Downloading Images with Google API Key
« Reply #3 on: March 18, 2022, 06:58:47 PM »
Happy to help, thank you again for using the SimCenter forum!