Google Maps v2 Projection.toScreenLocation(…) extremely slow

后端 未结 2 664
悲&欢浪女
悲&欢浪女 2021-02-15 18:13

I have upgraded Google Maps v1 to v2 in my Android application.

And v2 was nice and so on BUT one method seems to be the slowest thing in my life.

Projec         


        
2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-15 18:31

    This answers comes probably too late, but if anybody else runs into the same problems, like me, a solution could be to pre-render an image on an own server with Java's Graphics2D (which works almost the same as drawing to the canvas) and download it within the app. You have to convert the geo points into cartesian coordinates. Within the app, you only have to position the image as GroundOverlay with LatLngBounds: https://developers.google.com/maps/documentation/android/groundoverlay#use_latlngbounds_to_position_an_image

    and add it to the map... https://developers.google.com/maps/documentation/android/groundoverlay#change_an_overlay

    For me, this approach works pretty fast. At least as fast as the Google Maps V1 approach.

提交回复
热议问题