A geocode is a
code that represents a geographic entity (
location
In geography, location or place are used to denote a region (point, line, or area) on Earth's surface or elsewhere. The term ''location'' generally implies a higher degree of certainty than ''place'', the latter often indicating an entity with an ...
or
object). It is a
unique identifier
A unique identifier (UID) is an identifier that is guaranteed to be unique among all identifiers used for those objects and for a specific purpose. The concept was formalized early in the development of computer science and information systems ...
of the entity, to distinguish it from others in a
finite set
In mathematics, particularly set theory, a finite set is a set that has a finite number of elements. Informally, a finite set is a set which one could in principle count and finish counting. For example,
:\
is a finite set with five elements. ...
of geographic entities. In general the ''geocode'' is a
human-readable
A human-readable medium or human-readable format is any encoding of data or information that can be naturally read by humans.
In computing, ''human-readable'' data is often encoded as ASCII or Unicode text, rather than as binary data. In most ...
and short identifier.
Typical geocodes and entities represented by it:
* ''Country code'' and subdivision code. Polygon of the administrative boundaries of a country or a subdivision.
The main examples are ISO codes:
ISO 3166-1 alpha-2
ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special are ...
code (e.g.
AF
for
Afghanistan
Afghanistan, officially the Islamic Emirate of Afghanistan,; prs, امارت اسلامی افغانستان is a landlocked country located at the crossroads of Central Asia and South Asia. Referred to as the Heart of Asia, it is bord ...
or
BR
for
Brazil
Brazil ( pt, Brasil; ), officially the Federative Republic of Brazil (Portuguese: ), is the largest country in both South America and Latin America. At and with over 217 million people, Brazil is the world's fifth-largest country by area ...
), and its subdivision conventions, such as
subdivision codes (e.g.
AF-GHO
for
Ghor province
Ghōr (Dari: ), also spelled Ghowr or Ghur, is one of the thirty-four provinces of Afghanistan. It is located in the western Hindu Kush in central Afghanistan, towards the northwest. The province contains eleven districts, encompassing hundred ...
) or
subdivision codes (e.g.
BR-AM
for
Amazonas state).
* ''DGG cell ID''. Identifier of a cell of a
discrete global grid
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 strate ...
: a
Geohash
Geohash is a public domain geocode system invented in 2008 by Gustavo NiemeyerEvidences at the Wayback Machine:
labix.org in 2008, the G. Niemeyer's blog announcing Geohash
*an article about Geohash witnessing and citing G. Niemeyer works, befor ...
code (e.g. ~0.023 km
2 cell
6vjyngd
at the
Brazilian's center) or an
OLC code (e.g. ~0.004 km
2 cell
58PJ642P+4
at the same point).
* ''Postal code''. Polygon of a
postal area
The list of postcode areas in the United Kingdom is a tabulation of the postcode areas used by Royal Mail for the purposes of directing mail within the United Kingdom. The postcode area is the largest geographical unit used and forms the initia ...
: a
CEP
''Boletus edulis'' (English: cep, penny bun, porcino or porcini) is a basidiomycete fungus, and the type species of the genus ''Boletus''. Widely distributed in the Northern Hemisphere across Europe, Asia, and North America, it does not occu ...
code (e.g.
70040
represents a Brazilian's central area for postal distribution).
Geocodes are mainly used (in general as an
atomic data type) for
labelling
Labelling or using a label is describing someone or something in a word or short phrase. For example, the label "criminal" may be used to describe someone who has broken a law. Labelling theory is a theory in sociology which ascribes labelling ...
,
data integrity
Data integrity is the maintenance of, and the assurance of, data accuracy and consistency over its entire life-cycle and is a critical aspect to the design, implementation, and usage of any system that stores, processes, or retrieves data. The ter ...
,
geotagging
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 RSS feeds and is a form of geospatial metadata. This data ...
and
spatial indexing.
In
theoretical computer science
Theoretical computer science (TCS) is a subset of general computer science and mathematics that focuses on mathematical aspects of computer science such as the theory of computation, lambda calculus, and type theory.
It is difficult to circumsc ...
a ''geocode system'' is a
locality-preserving hashing function.
Classification

There are some common aspects of many geocodes (or
geocode systems) that can be used as classification criteria:
* ''Ownership'': proprietary or
free, differing by its
licences.
* ''Formation'': the geocode can be originated from a name (ex. abbreviation of official name the country) or from mathematical function (
encoding
In communications and information processing, code is a system of rules to convert information—such as a letter (alphabet), letter, word, sound, image, or gesture—into another form, sometimes data compression, shortened or secrecy, secret ...
algorithm to compress
latitude-longitude). See ''geocode system'' types below (of
names
A name is a term used for identification by an external observer. They can identify a class or category of things, or a single thing, either uniquely, or within a given context. The entity identified by a name is called its referent. A persona ...
and of
grids).
* ''Covering'': global or partial. The entities (represented by the geocodes) are in all globe (e. g. geographical points) or is delimited the theme (e.g. only terrestrial areas) or by the ownership's jurisdiction (e.g. only into a country).
* ''Type of the represented entity'':
type of geometry. Point (the geocode can be translated to a
Geo URI
The geo URI scheme is a Uniform Resource Identifier (URI) scheme defined by the Internet Engineering Task Force's RFC 5870 (published 8 June 2010) as:
a Uniform Resource Identifier (URI) for geographic locations using the 'geo' scheme name. A ...
), grid cell (the geocode system is related with a
DGG DGG may refer to:
* Deutsche Geophysikalische Gesellschaft, a society for geophysics
* Deutsche Grammophon Gesellschaft, a record label
* Discrete Global Grid
*Dutch Game Garden an organization with the aim of promoting and improving the video g ...
) or polygon (typically administrative boundaries delimitations).
** special hierarchical grids, with global covering and equal-area cells, can be classified as ''DGGS cell''
[The OGS's standard]
Discrete Global Grid Systems
definition.
** some non-standard geographic entities, can be classified also by its
coordinate system and elipsoid of reference (e.g.
UTM
UTM may refer to:
Computing
* Unified threat management, an approach to network security
* Universal Turing machine, a theoretical computer
* Urchin Tracking Module, a Web analytics package that served as the base for Google Analytics
* Usabil ...
). The
''de facto'' standard is the
WGS84
The World Geodetic System (WGS) is a standard used in cartography, geodesy, and satellite navigation including GPS. The current version, WGS 84, defines an Earth-centered, Earth-fixed coordinate system and a geodetic datum, and also desc ...
.
* ''Scope of use'': general use vs specialized (e.g. airport geocodes).
* ''Hierarchy'': geocode's syntax hierarchy corresponding to the spatial hierarchy of its represented entities. A geocode system can hierarchical (
name or
grid
Grid, The Grid, or GRID may refer to:
Common usage
* Cattle grid or stock grid, a type of obstacle is used to prevent livestock from crossing the road
* Grid reference, used to define a location on a map
Arts, entertainment, and media
* News g ...
) or non-hierarchical.
Geocode system
The set of all geocodes used as unique identifiers of the cells of a
full-coverage of the
geographic surface (or any well-defined area like a country or the oceans), is a geocode system (also named ''geocode scheme''). The
syntax and
semantic
Semantics (from grc, σημαντικός ''sēmantikós'', "significant") is the study of reference, meaning, or truth. The term can be used to refer to subfields of several distinct disciplines, including philosophy, linguistics and comput ...
of the geocodes are also components of the system definition:
* geocode syntax: the characters that can be used, blocks of characters and its size and order. Example: country codes use two letters of the alphabet (chacacter set A-Z). The most commom way to describe formally is by
regular expression
A regular expression (shortened as regex or regexp; sometimes referred to as rational expression) is a sequence of characters that specifies a search pattern in text. Usually such patterns are used by string-searching algorithms for "find" ...
(e.g.
/ -Z
).
* geocode semantic: the meaning of the geocode, usually expressed by associating the code with a geographical entity type. Can be described formally is by an
ontology
In metaphysics, ontology is the philosophical study of being, as well as related concepts such as existence, becoming, and reality.
Ontology addresses questions like how entities are grouped into categories and which of these entities ...
, an
UML class diagram or any
Entity-relationship model.
In general the semantic can be deduced by its formation or encoding/decoding process. Example: each Geohash code can be expressed by a rectangular area in the map, and the rectangle coordinates is obtained by its decoding process.
Many syntax and semantic characteristics are also summarized by classification.
Encode and decode
Any geocode can be translated from a formal (and expanded) expression of the geographical entity, or vice versa, the geocode translated to entity. The first is named encode process, the second decode. The actors and process involved, as defined by
OGC,
[Definitions of the OGC's]
Glossary of Terms
. are:
;geocoder: A
software agent
In computer science, a software agent or software AI is a computer program that acts for a user or other program in a relationship of agency, which derives from the Latin ''agere'' (to do): an agreement to act on one's behalf. Such "action on behal ...
that transforms the description of a geographic entity (e.g. location name or latitude/longitude coordinates), into a normalized data and encodes it as a geocode.
;geocoder service: A geocoder implemented as
web service (or similar service interface), that accepts a set of geographic entity descriptors as input. The request is "sent" to the Geocoder Service, which processes the request and returns the resulting geocodes. More general services can also return geographic features (e.g.
GeoJSON
GeoJSON is an open standard format designed for representing simple geographical features, along with their non-spatial attributes. It is based on the JSON format.
The features include points (therefore addresses and locations), line strings ( ...