@Override public String toString() { return "(" + getLatitude() + ", " + getLongitude() + ")"; }
@Override public boolean onTap(GeoPoint p,MapView mapView){ Log.d("TOUCHED_PLACE", "Latitutde:"+p.getLatitudeE6()/1E6 + " Longitude:"+p.getLongitude()/1E6); }
@Override public String toString() { return "(" + getLatitude() + ", " + getLongitude() + ")"; }
public static double distanceBetween(GeoPoint geoPoint1, GeoPoint geoPoint2) { return distanceBetween( geoPoint1.getLatitude(), geoPoint1.getLongitude(), geoPoint2.getLatitude(), geoPoint2.getLongitude()); }
public static double distanceBetween(GeoPoint geoPoint1, GeoPoint geoPoint2) { return distanceBetween( geoPoint1.getLatitude(), geoPoint1.getLongitude(), geoPoint2.getLatitude(), geoPoint2.getLongitude()); }
GetNService gn = new GetNService(); NGeoPoint nearest = gn.getN(lat, lon); GeoPoint city = nearest.getPoint(); double lat = city.getLatitude(); double lon = city.getLongitude();
double lon1 = Math.toRadians(currPoint.getLongitude()); double lat2 = Math.toRadians(nextPoint.getLatitude()); double lon2 = Math.toRadians(nextPoint.getLongitude());
String longitude = String.valueOf(geoPoint.getLongitude()); String distance = jsonObject.getJSONObject("distance").getString("text"); mMap.addMarker(new MarkerOptions().position(new LatLng(geoPoint.getLatitude(), geoPoint.getLongitude())) .title(nameBeach) .snippet(distance + ", " + duration)
} else { latitude = String.valueOf(geoPoint.getLatitude()); longitude = String.valueOf(geoPoint.getLongitude());
for(int i=0;i<listToSearch.size();i++){ GeoPoint currentPoint = listToSearch.get(i); double currentPointDist = distFrom( point.getLatitude(), point.getLongitude(), currentPoint.getLatitude(), currentPoint.getLongitude()); if(i==0){ index = i;
return new Coordinate(toX(geoPoint, geoPointRelative.getLongitude()), toY(geoPoint, geoPointRelative.getLatitude()));
@Override public boolean within(GeoShape geoShape) { if (geoShape instanceof GeoPoint) { GeoPoint pt = (GeoPoint) geoShape; return GeoPoint.distanceBetween(getLatitude(), getLongitude(), pt.getLatitude(), pt.getLongitude()) <= getRadius(); } throw new SecureGraphException("Not implemented for argument type " + geoShape.getClass().getName()); }
@Override public boolean within(GeoShape geoShape) { if (geoShape instanceof GeoPoint) { GeoPoint pt = (GeoPoint) geoShape; return GeoPoint.distanceBetween(getLatitude(), getLongitude(), pt.getLatitude(), pt.getLongitude()) <= getRadius(); } throw new SecureGraphException("Not implemented for argument type " + geoShape.getClass().getName()); }
@Override public int compareTo(GeoPoint other) { int i; if ((i = compare(getLatitude(), other.getLatitude())) != 0) { return i; } if ((i = compare(getLongitude(), other.getLongitude())) != 0) { return i; } if (getAltitude() != null && other.getAltitude() != null) { return compare(getAltitude(), other.getAltitude()); } if (getAltitude() != null) { return 1; } if (other.getAltitude() != null) { return -1; } return 0; }
@Override public int compareTo(GeoPoint other) { int i; if ((i = compare(getLatitude(), other.getLatitude())) != 0) { return i; } if ((i = compare(getLongitude(), other.getLongitude())) != 0) { return i; } if (getAltitude() != null && other.getAltitude() != null) { return compare(getAltitude(), other.getAltitude()); } if (getAltitude() != null) { return 1; } if (other.getAltitude() != null) { return -1; } return 0; }
Map<String, Object> propertyValueMap = new HashMap<>(); propertyValueMap.put("lat", geoPoint.getLatitude()); propertyValueMap.put("lon", geoPoint.getLongitude());
Map<String, Object> propertyValueMap = new HashMap<>(); propertyValueMap.put("lat", geoPoint.getLatitude()); propertyValueMap.put("lon", geoPoint.getLongitude()); jsonBuilder.field(property.getName() + ElasticSearchSearchIndexBase.GEO_PROPERTY_NAME_SUFFIX, propertyValueMap); if (geoPoint.getDescription() != null) {
Map<String, Object> propertyValueMap = new HashMap<>(); propertyValueMap.put("lat", geoPoint.getLatitude()); propertyValueMap.put("lon", geoPoint.getLongitude()); jsonBuilder.field(property.getName() + ElasticSearchSearchIndexBase.GEO_PROPERTY_NAME_SUFFIX, propertyValueMap); if (geoPoint.getDescription() != null) {
@Test public void testGraphQueryGeoPoint() { graph.prepareVertex("v1", VISIBILITY_A) .setProperty("location", new GeoPoint(38.9186, -77.2297, "Reston, VA"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.prepareVertex("v2", VISIBILITY_A) .setProperty("location", new GeoPoint(38.9544, -77.3464, "Reston, VA"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); List<Vertex> vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", GeoCompare.WITHIN, new GeoCircle(38.9186, -77.2297, 1)) .vertices()); assertEquals(1, count(vertices)); GeoPoint geoPoint = (GeoPoint) vertices.get(0).getPropertyValue("location"); assertEquals(38.9186, geoPoint.getLatitude(), 0.001); assertEquals(-77.2297, geoPoint.getLongitude(), 0.001); assertEquals("Reston, VA", geoPoint.getDescription()); vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", GeoCompare.WITHIN, new GeoCircle(38.9186, -77.2297, 25)) .vertices()); assertEquals(2, count(vertices)); vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", TextPredicate.CONTAINS, "Reston") .vertices()); assertEquals(2, count(vertices)); }
@Test public void testGraphQueryGeoPoint() { graph.prepareVertex("v1", VISIBILITY_A) .setProperty("location", new GeoPoint(38.9186, -77.2297, "Reston, VA"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); graph.prepareVertex("v2", VISIBILITY_A) .setProperty("location", new GeoPoint(38.9544, -77.3464, "Reston, VA"), VISIBILITY_A) .save(AUTHORIZATIONS_A_AND_B); List<Vertex> vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", GeoCompare.WITHIN, new GeoCircle(38.9186, -77.2297, 1)) .vertices()); assertEquals(1, count(vertices)); GeoPoint geoPoint = (GeoPoint) vertices.get(0).getPropertyValue("location"); assertEquals(38.9186, geoPoint.getLatitude(), 0.001); assertEquals(-77.2297, geoPoint.getLongitude(), 0.001); assertEquals("Reston, VA", geoPoint.getDescription()); vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", GeoCompare.WITHIN, new GeoCircle(38.9186, -77.2297, 25)) .vertices()); assertEquals(2, count(vertices)); vertices = toList(graph.query(AUTHORIZATIONS_A) .has("location", TextPredicate.CONTAINS, "Reston") .vertices()); assertEquals(2, count(vertices)); }