谷歌地图api圆形半径和标记在一起

时间:2014-05-29 14:10:20

标签: android google-maps google-maps-api-3 google-maps-markers

我正在尝试使用谷歌地图api的一些技巧。我想

  • 获取当前位置的lat日志并放大地图。

    //获取当前位置         位置location = locationManager.getLastKnownLocation(provider);

  • 在Google地图上的当前位置周围创建一个半径,而不是“点”。我位置周围的圆形半径

  • 然后使用Marker手动点击地图上非常靠近我的位置并获得拉特长。

基本上我正在尝试的是我需要在我附近的建筑物上准确地放置标记。

我希望我有道理。任何建议都会有所帮助。

由于 沙市

1 个答案:

答案 0 :(得分:1)

你可以试试这个

LocationManager manager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
Location location = manager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
            LatLng myLoc = null;
myLoc = new LatLng(location.getLatitude(),
                        location.getLongitude());
CameraUpdate center = CameraUpdateFactory.newLatLng(myLoc); //optional
                CameraUpdate zoom = CameraUpdateFactory.zoomTo(12); //optional

googleMap.addMarker(new MarkerOptions()
                    .position(myLoc)
                    .title("title you want to show")
                    .snippet("anything you want to show")
                    .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
相关问题