Java Code Examples for org.osmdroid.api.IGeoPoint#getLongitude()
The following examples show how to use
org.osmdroid.api.IGeoPoint#getLongitude() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleFastPointOverlay.java From osmdroid with Apache License 2.0 | 6 votes |
public SimpleFastPointOverlay(PointAdapter pointList, SimpleFastPointOverlayOptions style) { mStyle = style; mPointList = pointList; Double east = null, west = null, north = null, south = null; for(IGeoPoint p : mPointList) { if(p == null) continue; if(east == null || p.getLongitude() > east) east = p.getLongitude(); if(west == null || p.getLongitude() < west) west = p.getLongitude(); if(north == null || p.getLatitude() > north) north = p.getLatitude(); if(south == null || p.getLatitude() < south) south = p.getLatitude(); } if(east != null) mBoundingBox = new BoundingBox(north, east, south, west); else mBoundingBox = null; }
Example 2
Source File: BoundingBox.java From osmdroid with Apache License 2.0 | 6 votes |
public static BoundingBox fromGeoPoints(final List<? extends IGeoPoint> partialPolyLine) { double minLat = Double.MAX_VALUE; double minLon = Double.MAX_VALUE; double maxLat = -Double.MAX_VALUE; double maxLon = -Double.MAX_VALUE; for (final IGeoPoint gp : partialPolyLine) { final double latitude = gp.getLatitude(); final double longitude = gp.getLongitude(); minLat = Math.min(minLat, latitude); minLon = Math.min(minLon, longitude); maxLat = Math.max(maxLat, latitude); maxLon = Math.max(maxLon, longitude); } return new BoundingBox(maxLat, maxLon, minLat, minLon); }
Example 3
Source File: NativeOpenStreetMapController.java From appinventor-extensions with Apache License 2.0 | 5 votes |
@Override public boolean onLongPress(final MotionEvent pEvent, final MapView pMapView) { IGeoPoint p = pMapView.getProjection().fromPixels((int) pEvent.getX(), (int) pEvent.getY()); final double lat = p.getLatitude(); final double lng = p.getLongitude(); for (MapEventListener l : eventListeners) { l.onLongPress(lat, lng); } return false; // We don't want to cancel propagation to other overlays }
Example 4
Source File: GeoPoint.java From osmdroid with Apache License 2.0 | 5 votes |
/** * @see <a href="https://en.wikipedia.org/wiki/Haversine_formula">Haversine formula</a> * @see <a href="http://www.movable-type.co.uk/scripts/gis-faq-5.1.html">GIS FAQ</a> * @since 6.0.0 * @return distance in meters */ public double distanceToAsDouble(final IGeoPoint other) { final double lat1 = DEG2RAD * getLatitude(); final double lat2 = DEG2RAD * other.getLatitude(); final double lon1 = DEG2RAD * getLongitude(); final double lon2 = DEG2RAD * other.getLongitude(); return RADIUS_EARTH_METERS * 2 * Math.asin(Math.min(1, Math.sqrt( Math.pow(Math.sin((lat2 - lat1) / 2), 2) + Math.cos(lat1) * Math.cos(lat2) * Math.pow(Math.sin((lon2 - lon1) / 2), 2) ))); }
Example 5
Source File: Projection.java From osmdroid with Apache License 2.0 | 5 votes |
@Override public Point toPixels(final IGeoPoint in, final Point out) { final LatLng latLng = new LatLng(in.getLatitude(), in.getLongitude()); final Point point = mProjection.toScreenLocation(latLng); if (out != null) { out.x = point.x; out.y = point.y; } return point; }
Example 6
Source File: GeoPoint.java From osmdroid with Apache License 2.0 | 4 votes |
/** * @since 6.0.3 */ public GeoPoint(final IGeoPoint pGeopoint) { this.mLatitude = pGeopoint.getLatitude(); this.mLongitude = pGeopoint.getLongitude(); }
Example 7
Source File: Projection.java From osmdroid with Apache License 2.0 | 4 votes |
@Override public Point toPixels(final IGeoPoint in, final Point out) { final com.google.android.maps.GeoPoint googleGeoPoint = new com.google.android.maps.GeoPoint((int)(in.getLatitude()*1E6), (int)(in.getLongitude()*1E6)); return mProjection.toPixels(googleGeoPoint, out); }