Geofield is a Drupal 8 module that provides a field type for storing geographic data. This data can be attached to any entity, e.g., nodes, users and taxonomy terms. Geofield provides different widgets for data input and formatters for data output. It integrates with other mapping modules (including ... and Geocoder),

The Geofield module can store data as Latitude and Longitude, Bounding Box and Well Known Text (WKT) and it supports all types of geographical data: points, lines, polygons, multi types, etcetera.

Install

Install and enable the Geofield module. Since 8.x-1.0-alpha2 version, this module is not depending on GeoPHP module anymore. Learn more about installing Drupal modules.

Please read https://www.drupal.org/node/2718229 for more information about composer dependencies.

Sample code for Composer based installs

Add the following to your composer.json file. Obviously the full block is only required if you don't have a require-dev block.

"require": {
   "drupal/geofield": "8.*"
},

The run $composer drupal-update //warning: this updates everything. Backup first...

Add a geofield to content

You can add geographical information to an entity (content type, user, taxonomy term or comment) by adding a geofield.

To add a geofield to e.g., a "Basic Page" go to /admin/structure/types/manage/page/fields/

Add a new field of the field type "Geofield", and choose the preferred widget, e.g., "OpenLayers Map". Configure the field according to the chosen options.

Display geographical information

Geofield Map

Geofield comes with the basic but easy-to-use submodule Geofield Map that allows you to display geographical data in a Google map.

OpenLayers

For more advanced and flexible data display you need to create and configure a map in OpenLayers 2.

If you use OpenLayers you need to enable the OpenLayers UI. After, you can set Geofield Formatter Map output as default map in /admin/structure/openlayers/. Choose "Geofield Formatter Map" in the field OpenLayers Default Map.

You can easily create your own map by cloning an existing one. Introduction to OpenLayers.
When you have configured a map in OpenLayers you must define to use the map for displaying data at /admin/structure/types/manage/page/display/.

Leaflet

Geofield integrates also with the lightweight map display tool Leaflet

Microdata & Schema.org

Geofield supports microdata, which can be used by scripts and search engines to extract the Geo information in a meaningful way.

When you have Microdata module enabled, you can configure your microdata output on the field configuration page. There are suggestions of appropriate Schema.org settings at the bottom of the form. Choose one and click "Use suggested mapping".

More info