Documentation
¶
Overview ¶
Package geo provides common geographic types and calculations. It centralizes location-based data structures and algorithms to ensure consistency across the codebase.
Index ¶
Constants ¶
const EarthRadius = 6371000.0
EarthRadius is the mean radius of Earth according to WGS-84 in meters
Variables ¶
This section is empty.
Functions ¶
func HaversineDistance ¶
HaversineDistance calculates the great-circle distance between two points on the Earth's surface given their latitude and longitude in degrees. The result is returned in meters.
Types ¶
type Address ¶
type Address struct {
Street string `json:"street,omitempty"`
HouseNumber string `json:"house_number,omitempty"`
City string `json:"city,omitempty"`
State string `json:"state,omitempty"`
Country string `json:"country,omitempty"`
PostalCode string `json:"postal_code,omitempty"`
Formatted string `json:"formatted,omitempty"`
}
Address represents a structured address
type BoundingBox ¶
type BoundingBox struct {
MinLat float64 `json:"minLat"` // Southern edge (minimum latitude)
MinLon float64 `json:"minLon"` // Western edge (minimum longitude)
MaxLat float64 `json:"maxLat"` // Northern edge (maximum latitude)
MaxLon float64 `json:"maxLon"` // Eastern edge (maximum longitude)
}
BoundingBox represents a geographic bounding box with southwest and northeast corners When used in API requests and responses, the field names must be lowercase with camelCase: minLat, minLon, maxLat, maxLon. Using different capitalization (e.g., MinLat) will cause parsing errors in API calls.
func NewBoundingBox ¶
func NewBoundingBox() *BoundingBox
NewBoundingBox creates a new empty bounding box
func (*BoundingBox) Buffer ¶
func (bb *BoundingBox) Buffer(bufferMeters float64)
Buffer adds a buffer around the bounding box in meters This is a rough approximation as it converts meters to degrees using a simple factor that's reasonably accurate near the equator.
func (*BoundingBox) ExtendWithPoint ¶
func (bb *BoundingBox) ExtendWithPoint(lat, lon float64)
ExtendWithPoint extends the bounding box to include the specified point
func (*BoundingBox) String ¶
func (bb *BoundingBox) String() string
String returns a string representation of the bounding box for use in Overpass queries