![]() | This article contains instructions, advice, or how-to content .(April 2016) |
Original author(s) | Alex Reisner |
---|---|
Initial release | 8 February 2006 |
Stable release | 1.3.0 / 30 January 2016 |
Written in | Ruby |
Operating system | Linux, OS X, Windows |
Type | Ruby library |
License | MIT License |
Website | www |
Geocoder (Ruby) is a geocoding library for Ruby. Geocoding helps to enhance webpages by presenting location relevant information to the user. When used with Rails, Geocoder adds geocoding functionality such as finding coordinates with street addresses or vice versa in addition to distance calculations for ActiveRecord objects. [1] Since the functionality does not rely on proprietary database functions, finding different geocoded objects in an area works out-of-the-box for databases like MySQL, PostgreSQL and SQLite. [1]
Geocoder has been fully tested with Ruby 1.8.7, 1.9.2, and JRuby 1.5.3. [1]
Geocoder is compatible with Rails 3, but there is only limited functionality with Rails 2. [1]
The Prerequisites to installing Geocoder are Ruby and RubyGems.
Geocoder gem can be installed with the following command:
gem install geocoder
Or, if you're using Bundler for Rails, you may add this to your Gemfile: [1]
gem 'geocoder'
and run at the command prompt: [2]
bundle install
It can be used as a plugin with rails too: [1]
rails plugin install git://github.com/alexreisner/geocoder.git
In order to use Geocoder with objects, the project must be set up as follows:
In order to use Geocoding with ActiveRecord objects, they must have two additional attributes, latitude and longitude coordinates. [1] When stored in the table they should be called latitude and longitude but they may be changed as explained below. When using reverse geocoding (translating a user's location coordinates into a physical address), the model must implement a method that returns an address. [3] The address may be a single attribute; however, it can also be a method which returns a string assembled from different attributes such as city, state, and country. [1]
When using Mongoid, the model only needs to add the address, latitude and longitudes as fields. The model must also include Geocoder::Model::Mongoid before making any calls to the geocoded_by: method. [1]
In the rails model, Geocoder must be told which method returns the object's full address: [1]
geocoded_by:full_street_address# can also be an IP addressafter_validation:geocode# auto-fetch coordinates
For reverse geocoding, Geocoder must know which method returns latitude and longitude coordinates. If :address option is not provided, it fetches the address automatically in the address attribute. Else, it fetches the address into the location attribute like the example given below. [1]
reverse_geocoded_by:latitude,:longitude,:address=>:locationafter_validation:reverse_geocode# auto-fetch address
Forward and Reverse Geocoding on the same model is possible. [1]
geocoded_by:addressreverse_geocoded_by:latitude,:longitudeafter_validation:geocode,:reverse_geocode
In order to use different names for latitude and longitude in the model, the following change may be done when implementing geocoded_by: [1]
geocoded_by:address,:latitude=>:lat,:longitude=>:lon
Additionally, the address method may return any string that would be used to search Google Maps. [1] Any of the following examples will work:
By default, Geocoder makes use of Google's geocoding API to retrieve addresses and coordinates. Currently, these address geocoding services are supported:
Here are some examples [5] to demonstrate Geocoder functionality:
Hotel.near("Raleigh, North Carolina")
Finds hotels near Raleigh.
@restaurant.distance_to("Empire State Building")
Finds the distance from @restaurant to the Empire State Building.
A geographic information system (GIS) consists of integrated computer hardware and software that store, manage, analyze, edit, output, and visualize geographic data. Much of this often happens within a spatial database; however, this is not essential to meet the definition of a GIS. In a broader sense, one may consider such a system also to include human users and support staff, procedures and workflows, the body of knowledge of relevant concepts and methods, and institutional organizations.
A geographic coordinate system (GCS) is a spherical or geodetic coordinate system for measuring and communicating positions directly on Earth as latitude and longitude. It is the simplest, oldest and most widely used type of the various spatial reference systems that are in use, and forms the basis for most others. Although latitude and longitude form a coordinate tuple like a cartesian coordinate system, the geographic coordinate system is not cartesian because the measurements are angles and are not on a planar surface.
A geocode is a code that represents a geographic entity. It is a unique identifier of the entity, to distinguish it from others in a finite set of geographic entities. In general the geocode is a human-readable and short identifier.
ISO 6709, Standard representation of geographic point location by coordinates, is the international standard for representation of latitude, longitude and altitude for geographic point locations.
A geotagged photograph is a photograph which is associated with a geographic position by geotagging. Usually this is done by assigning at least a latitude and longitude to the image, and optionally elevation, compass bearing and other fields may also be included.
Geotagging, or GeoTagging, is the process of adding geographical identification metadata to various media such as a geotagged photograph or video, websites, SMS messages, QR Codes or RgSSfeeds and is a form of geospatial metadata. This data usually consists of latitude and longitude coordinates, though they can also include altitude, bearing, distance, accuracy data, and place names, and perhaps a time stamp.
Address geocoding, or simply geocoding, is the process of taking a text-based description of a location, such as an address or the name of a place, and returning geographic coordinates, frequently latitude/longitude pair, to identify a location on the Earth's surface. Reverse geocoding, on the other hand, converts geographic coordinates to a description of a location, usually the name of a place or an addressable location. Geocoding relies on a computer representation of address points, the street / road network, together with postal and administrative boundaries.
Microformats (μF) are predefined HTML markup created to serve as descriptive and consistent metadata about elements, designating them as representing a certain type of data. They allow software to process the information reliably by having set classes refer to a specific type of data rather than being arbitrary.
In geography, location or place are used to denote a region on Earth's surface. The term location generally implies a higher degree of certainty than place, the latter often indicating an entity with an ambiguous boundary, relying more on human or social attributes of place identity and sense of place than on geometry. A populated place is called a settlement.
This is a list of the National Register of Historic Places listings in Maricopa County, Arizona, excluding those in Phoenix, for which there is a separate list.
Geo is a microformat used for marking up geographical coordinates in HTML. Coordinates are expected in angular units of degrees and geodetic datum WGS84. Although termed a "draft" specification, the format is a de facto standard, stable and in widespread use; not least as a sub-set of the published hCalendar and hCard microformat specifications, neither of which is still a draft.
Geohash is a public domain geocode system invented in 2008 by Gustavo Niemeyer which encodes a geographic location into a short string of letters and digits. Similar ideas were introduced by G.M. Morton in 1966. It is a hierarchical spatial data structure which subdivides space into buckets of grid shape, which is one of the many applications of what is known as a Z-order curve, and generally space-filling curves.
Reverse geocoding is the process of converting a location as described by geographic coordinates to a human-readable address or place name. It is the opposite of forward geocoding, hence the term reverse. Reverse geocoding permits the identification of nearby street addresses, places, and/or areal subdivisions such as neighbourhoods, county, state, or country. Combined with geocoding and routing services, reverse geocoding is a critical component of mobile location-based services and Enhanced 911 to convert a coordinate obtained by GPS to a readable street address which is easier to understand by the end user, but not necessarily with a better accuracy.
This is a list of the National Register of Historic Places listings in Fergus County, Montana. It is intended to be a complete list of the properties and districts on the National Register of Historic Places in Fergus County, Montana, United States. The locations of National Register properties and districts for which the latitude and longitude coordinates are included below, may be seen in a map.
The geo URI scheme is a Uniform Resource Identifier (URI) scheme defined by the Internet Engineering Task Force's RFC 5870 as:
a Uniform Resource Identifier (URI) for geographic locations using the 'geo' scheme name. A 'geo' URI identifies a physical location in a two- or three-dimensional coordinate reference system in a compact, simple, human-readable, and protocol-independent way.
In geographic information systems, toponym resolution is the relationship process between a toponym, i.e. the mention of a place, and an unambiguous spatial footprint of the same place.
A discrete global grid (DGG) is a mosaic that covers the entire Earth's surface. Mathematically it is a space partitioning: it consists of a set of non-empty regions that form a partition of the Earth's surface. In a usual grid-modeling strategy, to simplify position calculations, each region is represented by a point, abstracting the grid as a set of region-points. Each region or region-point in the grid is called a cell.
Baidu Maps is a desktop and mobile web mapping service application and technology provided by Baidu, offering satellite imagery, street maps, street view and indoor view perspectives, as well as functions such as a route planner for traveling by foot, car, or with public transport. Android and iOS applications are available.
Under Chinese law, the use of geographic information in the People's Republic of China is restricted to entities that have special authorization from the administrative department for surveying and mapping under the State Council. Consequences of the restriction include fines for unauthorized surveys, lack of geotagging information on many cameras when the GPS chip detects a location within China, and incorrect alignment of street maps with satellite maps in various applications.
The Open Location Code (OLC) is a geocode based on a system of regular grids for identifying an area anywhere on the Earth. It was developed at Google's Zürich engineering office, and released late October 2014. Location codes created by the OLC system are referred to as "plus codes".