android generate bitmap from google map without mapView

懵懂的女人 提交于 2019-12-06 16:52:46

问题


I want to generate a bitmap file using google maps without passing data through a mapView, like a background thread (downloading tiles in order to write the bitmap)

Does anyone has an idea?

an example is: entering coordinates and after clicking a button, the .png is generated in the SD Card, containing the COMPLETE loaded tiles.

any proposals?

thanks!!!


回答1:


This method returns url with map image

public static String getMapUrl(Double lat, Double lon, int width, int height) {
    final String coordPair = lat + "," + lon;
    return "http://maps.googleapis.com/maps/api/staticmap?"
            + "&zoom=16"
            + "&size=" + width + "x" + height
            + "&maptype=roadmap&sensor=true"
            + "&center=" + coordPair
            + "&markers=color:black|" + coordPair;
}

You can download or display it on ImageView



来源:https://stackoverflow.com/questions/12107608/android-generate-bitmap-from-google-map-without-mapview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!