
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
h1. Geo Point
Adds the concept of a GeoPoint for geo libraries. A GeoPoint encapsulates latitude and longitude, and:
Using GeoPoints makes it much easier and more efficient to transport location point data and various geo libraries adds additional functionality such as vector operations on top (see fx "geo_vectors":https://github.com/kristianmandrup/geo_vectors gem). Enjoy!
h2. Install
Gemfile:
@gem 'geo_point'@
$ bundle
h2. Status Sept 2012
Currently a few of the specs break. Please help Fix. They might be related to geo_calc and/or geo_units gems.
h2. Quick start (Usage)
First define the points on the globe you want to work with. The GeoPoint initializer is very flexible with regards to the arguments it can handle.
# factory method on core ruby classes "51 12 03 N, 24 10 02 E".geo_point [51.5136, -0.0983].geo_point {:latitude => 27.3, :longitude => "24 10 02 E"}.geo_point # two arguments p1 = GeoPoint.new 51.5136, -0.0983 p2 = GeoPoint.new "14 11 01 N", "-0.0983" p3 = GeoPoint.new 51.5136, "24 10 02 E" # a String p1 = GeoPoint.new "51.5136, -0.0983" p1 = GeoPoint.new "51.5136, 24 10 02 E" p3 = GeoPoint.new "51.4778, -0.0015" p1 = GeoPoint.new "51 12 03 N, 24 10 02 E" # an Array p2 = GeoPoint.new [51.5136, -0.0983] p2 = GeoPoint.new [51.5136, "24 10 02 E"] p2 = GeoPoint.new [51.5136, {:lon => 27.3}] # a Hash p4 = GeoPoint.new {:lat => 27.3, :lng => "24 10 02 E"} p4 = GeoPoint.new {:latitude => 27.3, :longitude => "24 10 02 E"}
h2. Utility methods
These are some of the utility methods you can use on a GeoPoint object
p1 = GeoPoint.new 5.1, -7 p1.lat # latitude p1.lon # longitude p1.to_lat_lng # Array representation of [lat, lng] p1.to_lng_lat # Array representation of [lng, lat] p1.to_s # String representation (DMS format) p1.to_coords # calls either #to_lat_lng or #to_lng_lat depending on global :coord_mode setting
h2. Global configuration options
GeoPoint.coord_mode = :lat_lng GeoPoint.coord_mode = :lng_lat GeoPoint.earth_radius_km = 6379 GeoPoint.earth_radius_km = 6371
h2. GeoPoint functionality
A GeoPoint always has the following calculation API available:
Rhumb: (see "Rhumb_line":http://en.wikipedia.org/wiki/Rhumb_line)
See the "geo_calc":https://github.com/kristianmandrup/geo_calc gem for details on how to use this Api
h2. Contributing to geo_point
h2. Copyright
Copyright (c) 2011 Kristian Mandrup. See LICENSE.txt for further details.
FAQs
Unknown package
We found that geo_point demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.