Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultSQLConf = &SQLConf{driver: "postgres", openStr: defaultOpenStr, table: "points", latCol: "lat", lngCol: "lng"}
Functions ¶
This section is empty.
Types ¶
type GoogleGeocoder ¶
type GoogleGeocoder struct{}
func (*GoogleGeocoder) ReverseGeocode ¶
func (g *GoogleGeocoder) ReverseGeocode(p *Point) (string, error)
type MapQuestGeocoder ¶
type MapQuestGeocoder struct { }
A Geocoder that makes use of open street map's geocoding service
func (*MapQuestGeocoder) Geocode ¶
func (g *MapQuestGeocoder) Geocode(query string) (*Point, error)
Use MapQuest's open service for geocoding @param [String] str. The query in which to geocode.
func (*MapQuestGeocoder) ReverseGeocode ¶
func (g *MapQuestGeocoder) ReverseGeocode(p *Point) (string, error)
type Point ¶
type Point struct {
// contains filtered or unexported fields
}
Represents a Physical Point in geographic notation [lat, lng] @field [float64] lat. The geographic latitude representation of this point. @field [float64] lng. The geographic longitude representation of this point.
func (*Point) GreatCircleDistance ¶
Original Implementation from: http://www.movable-type.co.uk/scripts/latlong.html Calculates the Haversine distance between two points. @param *Point. The destination point. @return [float64]. The distance between the origin point and the destination point.
func (*Point) PointAtDistanceAndBearing ¶
Original Implementation from: http://www.movable-type.co.uk/scripts/latlong.html @param [float64] dist. The arc distance in which to transpose the origin point (in meters). @param [float64] bearing. The compass bearing in which to transpose the origin point (in degrees). @return *Point. Returns a Point struct populated with the lat and lng coordinates
of transposing the origin point a certain arc distance at a certain bearing.
type SQLConf ¶
type SQLConf struct {
// contains filtered or unexported fields
}
Provides the configuration to query the database as necessary
func GetSQLConf ¶
Attempts to read config/geo.yml, and creates a {SQLConf} as described in the file Returns the DefaultSQLConf if no config/geo.yml is found. @return *SQLConf. The SQLConfiguration, as supplied with config/geo.yml @return [Error]. Any error that might occur while grabbing configuration
type SQLMapper ¶
type SQLMapper struct {
// contains filtered or unexported fields
}
A Mapper that uses Standard SQL Syntax to perform mapping functions and queries
func HandleWithSQL ¶
@return *SQLMapper. An instantiated SQLMapper struct with the DefaultSQLConf. @return [Error]. Any error that might have occured during instantiating the SQLMapper.
func (*SQLMapper) PointsWithinRadius ¶
Original implemenation from : http://www.movable-type.co.uk/scripts/latlong-db.html Uses SQL to retrieve all points within the radius of the origin point passed in. @param *Point. The origin point. @param [float64]. The radius (in meters) in which to search for points from the Origin. TODO Potentially fallback to PostgreSQL's earthdistance module: http://www.postgresql.org/docs/8.3/static/earthdistance.html TODO Determine if valuable to just provide an abstract formula and then select accordingly, might be helpful for NOSQL wrapper