How to retrieve snapshot of map from place-picker activity?

后端 未结 5 889
时光说笑
时光说笑 2020-12-05 18:04

I\'m creating an app which picks places from the Google maps and stores the address in the database. I also want to store the snapshot of the picked place in the storage, so

5条回答
  •  借酒劲吻你
    2020-12-05 18:31

    Since you are able to get the long and lat coordinates, you can get the map image by using the Google maps api.

    Here's the link with examples and docs:

    https://developers.google.com/maps/documentation/static-maps/intro

    I assume this is what the dialog is doing in the background.

    If that does not work, or you want something more exact, I suggest using Wireshark to monitor exactly what data is being sent and received.

    I just ran a test with your map locations, and with this url:

    https://maps.googleapis.com/maps/api/staticmap?center=37.430610,%20-121.972090&zoom=17&size=400x400&key=[myAPIKey]

    I got this image:

    Using the coords from your dialog:

    Using https://maps.googleapis.com/maps/api/staticmap?markers=37.414333,-122.076444&zoom=17&size=400x250&key=[myKey]

提交回复
热议问题