com.stackmob.sdk.api
Class StackMobGeoPoint

java.lang.Object
  extended by com.stackmob.sdk.api.StackMobGeoPoint

public class StackMobGeoPoint
extends Object

Represents a longitude/latitude pair that can be stored and queried against in StackMob


Constructor Summary
StackMobGeoPoint(Double lon, Double lat)
          create a geopoint in terms of longitude and latitude radian
 
Method Summary
 List<String> asList()
          a list representation of this geopoint
 Double getLatitude()
          the latitude of this geopoint
 Double getLongitude()
          the longitude of this geopoint
 Double getQueryDistanceRadians()
          if this GeoPoint came from a "fieldIsNear" query, this will return the distance between this point and the reference point from the query
static Double kmToRadians(double km)
          convert kilometers to radians on the Earth's surface
static Double miToRadians(double mi)
          convert miles to radians on the Earth's surface
static Double radiansToKm(double radians)
          convert radians on the Earth's surface to kilometers
static Double radiansToMi(double radians)
          convert radians on the Earth's surface to miles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackMobGeoPoint

public StackMobGeoPoint(Double lon,
                        Double lat)
create a geopoint in terms of longitude and latitude radian

Parameters:
lon - longitude between +/- 180
lat - latitude between +/- 90
Method Detail

getLongitude

public Double getLongitude()
the longitude of this geopoint

Returns:
the longitude

getLatitude

public Double getLatitude()
the latitude of this geopoint

Returns:
the latitude

getQueryDistanceRadians

public Double getQueryDistanceRadians()
if this GeoPoint came from a "fieldIsNear" query, this will return the distance between this point and the reference point from the query

Returns:
the distance between this and the reference point

asList

public List<String> asList()
a list representation of this geopoint

Returns:
a list

radiansToMi

public static Double radiansToMi(double radians)
convert radians on the Earth's surface to miles

Parameters:
radians - input radians
Returns:
output miles

radiansToKm

public static Double radiansToKm(double radians)
convert radians on the Earth's surface to kilometers

Parameters:
radians - input radians
Returns:
output kilometers

miToRadians

public static Double miToRadians(double mi)
convert miles to radians on the Earth's surface

Parameters:
mi - input miles
Returns:
output radians

kmToRadians

public static Double kmToRadians(double km)
convert kilometers to radians on the Earth's surface

Parameters:
km - input kilometers
Returns:
output radians


Copyright © 2013 StackMob. All Rights Reserved.