Geofield is an advanced module for storing, managing and representing dynamic Geographic data in Drupal. It supports all geo-types (points, lines, polygons, multi types geometries, etc.), and integrates with various Js Mapping Libraries (Google Maps, Leaflet, Open Layers, etc.) and advanced Geocoding / Reverse Geocoding functionalities, via many other Drupal Geo Mapping modules.

## >>>> Live Demo <<<<

## Widgets (Data Input)

Latitude and Longitude
Supports entering data as both Decimal Degrees (122.340932) and Degrees-Minutes-Seconds (-123° 49' 55.2" W). The Degrees-Minutes-Seconds input is very tolerant of inconsistent input.

Bouding Box
Four textfields where lat / lon can be entered

Well Known Text (WKT)
A textarea for direct WKT input

Draw on an OpenLayers Map
Allows drawing of Points, Lines, Polygons and Bounding Boxes

HTML5 Geolocation
Transparently asks the browser for the user's current location. Works great on Chrome and smartphones with GPS.

Geocode from another field
There is native integrations with the Geocoder module (http://drupal.org/project/geocoder). This allows you to use data from one field to populate your geofield automatically. Supported geocoders include:

- Various PHP Geocoder Providers: Address Field, Textfield
- KML: File field, Textfield
- GPX: File field, Textfield
- GeoJSON: File field, Textfield
- Geotagged Image File: File field, Image field

## Formatters (Data Output)

Latitude and Longitude
Supports display as both Decimal Degrees (122.340932) and Degrees-Minutes-Seconds (-123° 49' 55.2" W)

Well Known Text (WKT)

GeoJSON

KML
KML is the format used by Google Earth

GPX
GPX is the format used by GPS devices

Google Maps, Leaflet and OpenLayers (only for D7) Maps
Display your data on a map, integrating other Drupal Geofield Mapping modules (see below).

## Installation and Setup

For Drupal 7 version all you need to do is install the Drupal GeoPHP module, which is required by geofield.

## Drupal 8 & 9, and GeoPHP library dependency

Since 8.x-1.0-alpha2 version, this module is not depending on Drupal GeoPHP module anymore.
The Drupal 8 & 9 version of Geofield module needs to be installed using Composer, it means simply running the following command from your project root (where the main composer.json file is sited):

$ composer require 'drupal/geofield'

This process will also download the required GeoPHP library dependency, that will be sited in the /vendor folder (as Drupal 8 default settings).

Note: Since version 8.x-1.20 Geofield also supports the Ludwig module/project, that offers an alternative to users who are not friendly with the command line tools or want to avoid Composer usage for other reasons.

Once installed you can enable the module in the usual way, both from the extend/modules backend interfaces or via drush with the following command:

$ drush en geofield

Once enabled the module it will be possible to add a "Geofield" field type to
any entity type/bundle and then choose the preferred widget or formatter.

## Compatible Modules

- Geofield Map: an advanced, complete and easy-to-use Geo Mapping solution for Drupal 8, based on Geofield
- OpenLayers: A very powerful mapping system based on the OpenLayers JavaScript library.
- Static Map: Simple maps based on Google Maps
- Leaflet: Moderately powerful mapping system based on the Leaflet JavaScript library
- Leaflet Widget: Input widget based on Leaflet library
- Geocoder: Geocode string & text addresses or file-uploads into Geofield locations and viceversa (Reverse Geocode)
- Geocoder AutoComplete: Auto-complete widget for Geocoder
- Address Field: Holds internationally compatible postal addresses based on xNAL. Compatible with Geocoder.
- Sync PostGIS: Sync geofield data into an external postGIS database, allowing you to perform full postGIS spatial queries.
- Openlayers Apachesolr: Integrates OpenLayers, Apache Solr, and Geofield
- Openlayers CCK Migrate: Migrate your old D6 openlayer_wkt fields to Geofield
- RSS Field Formatters: Provides `<georss:point>`, `<georss:polygon>` etc. element for geofields
- Views GeoJSON: Allows outputting of geofields into geoJSON using a view. Specifically useful with OpenLayers to build AJAX powered maps with lots of data.
- Search API Location: Adds geospatial-based searching to the Search API module.
- Spatial Tools: Tools for processing spatial files (ESRI Shapefiles, KML)
- Geofield PostGIS: Provides a PostGIS backend plugin for geofield. Geofield geometries are stored directly in PostGIS geometry or geography columns.
- Geofield Proximity Plugin: An add-on for the Geofield module with an alternative way to calculate distances from an origin point to polygons and multi-polygons in Views on single-valued and multi-valued Geofields.

## Resources

- Documentation for Drupal 7 (incomplete and outdated)
- README.txt for Drupal 7
- README.md for Drupal 8 & 9
- Book: Mapping with Drupal

## Credit

A special thanks to the following organization for sponsoring the development of geofield: HighWire Press, Phase 2, and GeoScienceWorld. Also, thanks to all of our contributing developers and many others who have helped with bug fixing and documentation.

<