2016-07-30 24 views
0

Ich habe den folgenden Code verwendet, um die OSM-Karte anzuzeigen.Wie animiert man die Kamera an den bestimmten Ort inOpen street map (OSM) in Android?

IMapController iMapController = map.getController(); 
    iMapController.setZoom(20); 
    GeoPoint geoPoint = new GeoPoint(11.9534485,79.8201425); 
    iMapController.setCenter(geoPoint); 

Ich mag die Kamera an den bestimmten Ort, wie in Google map.Is es möglich animieren, zu tun?

Bitte schlagen Sie einige Möglichkeiten vor, um fortzufahren.

+0

2 der Antworten hier sind für die Google-Bibliothek, weil Sie das Tag "openstreetmap" hinzugefügt, die zu breit ist, und in diesem Fall unnötig. –

Antwort

0

onMapReady dort Code setzen Animation Ihrer bestimmten Ort

final LatLngBounds.Builder mapboundbuilder = new LatLngBounds.Builder() Cemera;

mapboundbuilder.include ("IHR LATLNG-PAAR");

LatLngBounds tmpbnd = mapboundbuilder.build();

LatLng center = tmpbnd.getCenter(); LatLng NordEast = Consts.mappointmove (Mitte, 709, 709);

 LatLng southWest = Consts.mappointmove(center, 709, 709); 

     mapboundbuilder.include(southWest); 

     mapboundbuilder.include(northEast); 

     LatLngBounds bounds = mapboundbuilder.build(); 

     LatLng center = tmpbnd.getCenter(); 

     LatLng northEast = Consts.mappointmove(center, 709, 709); 

     LatLng southWest = Consts.mappointmove(center, 709, 709); 

     mapboundbuilder.include(southWest); 

     mapboundbuilder.include(northEast); 

     LatLngBounds bounds = mapboundbuilder.build(); 

     try { 
      int width, height; 
      Display display = getWindowManager().getDefaultDisplay(); 
      Point size = new Point(); 
      display.getSize(size); 
      width = size.x; 
      height = size.y - 250; 
      CameraUpdate cu = CameraUpdateFactory.newLatLngBounds(bounds, width, height, 100); 
      googleMap.animateCamera(cu); 
     } catch (Exception e) { 
      e.printStackTrace(); 
     } 
+0

Ich möchte in offener Straßenkarte nicht in Google Map tun. – Priya

0

Dieser Der Kodex für ist die Kamera an den bestimmten Ort in der Ansicht von Satelliten-Ansicht

public class NewMap implements OnMapReadyCallback{ 
 
@Override 
 
public void onMapReady(GoogleMap map){ 
 

 
//Enter Your Specific Location Here 
 

 
LatLng mySpecificLocation=new LatLng(11.9534485,79.8201425); 
 

 
map.moveCamera(CameraUpdateFactory.newLatLngZoom(mySpecificLocation,13)); 
 

 
//This one for change the map view into Steet View 
 
map.setMapType(GoogleMap.MAP_TYPE_SATELLITE); 
 

 
CameraPosition cameraPosition=CameraPosition.builder() 
 
//this one takes map position into your specific location 
 
.target(mySpecificLocation) 
 
//this one for camera zooming option 
 
.zoom(13) 
 
.build(); 
 
//This one for animate camera 
 
map.animateCamera(CameraUpdateFactory.newCameraPostion(camerapostion,2000,null)); 
 
} 
 
}

1

Verwenden Sie den folgenden Code animieren:

IMapController mapController; 

    final GeoPoint myPoint1 = new GeoPoint(lat, lng); 
     mapController.setCenter(myPoint1); 

    mapController.zoomTo(Integer.parseInt(15)); 
    map.getController().animateTo(myPoint1);