Refine search
GeoPoint startGP = new GeoPoint( (int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double .parseDouble(lngLat[0]) * 1E6)); myMC.setCenter(geoPoint); myMC.setZoom(15); myMapView.getOverlays().add(new DirectionPathOverlay(startGP, startGP)); gp2 = new GeoPoint((int) (Double.parseDouble(lngLat[1]) * 1E6), (int) (Double.parseDouble(lngLat[0]) * 1E6)); myMapView.getOverlays().add(new DirectionPathOverlay(gp1, gp2));
public class OsmdroidDemoMap extends Activity { private MapView mMapView; private MapController mMapController; int mIncr = 10000; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.osm_main); mMapView = (MapView) findViewById(R.id.mapview); mMapView.setTileSource(TileSourceFactory.MAPNIK); mMapView.setBuiltInZoomControls(true); mMapView.setMultiTouchControls(true); mMapController = mMapView.getController(); mMapController.setZoom(13); GeoPoint gPt0 = new GeoPoint(51500000, -150000); GeoPoint gPt1 = new GeoPoint(gPt0.getLatitudeE6()+ mIncr, gPt0.getLongitudeE6()); GeoPoint gPt2 = new GeoPoint(gPt0.getLatitudeE6()+ mIncr, gPt0.getLongitudeE6() + mIncr); GeoPoint gPt3 = new GeoPoint(gPt0.getLatitudeE6(), gPt0.getLongitudeE6() + mIncr); mMapController.setCenter(gPt0); PathOverlay myPath = new PathOverlay(Color.RED, this); myPath.addPoint(gPt0); myPath.addPoint(gPt1); myPath.addPoint(gPt2); myPath.addPoint(gPt3); myPath.addPoint(gPt0); mMapView.getOverlays().add(myPath); } }
p= new GeoPoint((int)(lattitude * 1E6), (int)(longitude * 1E6)); gMapView.displayZoomControls(true); mc=gMapView.getController(); mc.setCenter(p); mc.animateTo(p); mc.setZoom(14); LocationManager locationManager=(LocationManager) getSystemService(Context.LOCATION_SERVICE); locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 500.0f, this); String currentLocation="Lattitude :"+lat+" Longitude :"+lng; txted.setText(currentLocation); mc.animateTo(p);
int latMiddle = (int) ((posCar.getLatitudeE6() + posUser .getLatitudeE6()) / 2); int lonMiddle = (int) ((posCar.getLongitudeE6() + posUser .getLongitudeE6()) / 2); GeoPoint middle = new GeoPoint(latMiddle, lonMiddle); mc.setCenter(middle); mc.zoomToSpan(Math .abs(posCar.getLatitudeE6() - posUser.getLatitudeE6()), Math .abs(posCar.getLongitudeE6() - posUser.getLongitudeE6()));
@Override public void onLocationChanged(Location location) { if (mCaptureLocation) { mLocation = location; if (mLocation != null) { // Bug report: cached GeoPoint is being returned as the first value. // Wait for the 2nd value to be returned, which is hopefully not cached? ++mLocationCount; InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " onLocationChanged(" + mLocationCount + ") lat: " + mLocation.getLatitude() + " long: " + mLocation.getLongitude() + " acc: " + mLocation.getAccuracy() ); if (mLocationCount > 1) { mLocationStatus.setText(getString(R.string.location_provider_accuracy, mLocation.getProvider(), truncateFloat(mLocation.getAccuracy()))); mGeoPoint = new GeoPoint((int) (mLocation.getLatitude() * 1E6), (int) (mLocation.getLongitude() * 1E6)); mMapController.animateTo(mGeoPoint); if (mLocation.getAccuracy() <= mLocationAccuracy) { returnLocation(); } } } else { InfoLogger.geolog("GeoPointMapActivity: " + System.currentTimeMillis() + " onLocationChanged(" + mLocationCount + ") null location"); } } }
MapController mapController = mapView.getController(); mapController.setCenter(point)
MapController c = mapView.getController(); c.setCenter(new GeoPoint((x1+x2)/2,(y1+y2)/2)); c.zoomToSpan(x2, y2);
mMapVw.setReticleDrawMode(MapView.ReticleDrawMode.DRAW_RETICLE_OVER); mMapCtrlr = mMapVw.getController(); mMapCtrlr.setZoom(15); mMapCtrlr.setCenter(new GeoPoint(53500000, -3000000)); mMapVw.setOnTouchListener(this); Toast.makeText(this, "Screen x = " + x2 + " Screen y = " + y2, Toast.LENGTH_SHORT).show(); GeoPoint gPt = mMapVw.getProjection().fromPixels((int) x, (int)y); Toast.makeText(this, "Lat = " + gPt.getLatitudeE6() + " Lon = " + gPt.getLongitudeE6(), Toast.LENGTH_SHORT).show();
MapController mc; public void onLocationChanged(Location location) { List<Overlay> overlays = mapView.getOverlays(); myLocOverlay = new MyLocationOverlay(this, mapView); overlays.add(myLocOverlay); myLocOverlay.enableMyLocation();* // definitely need what's below int lat = (int) (location.getLatitude() * 1E6); int lng = (int) (location.getLongitude() * 1E6); GeoPoint point = new GeoPoint(lat, lng); mc.setCenter(point); mapView.invalidate(); }
MapController controller = mapView.getController(); controller.setCenter(youtgeopoint);