You are here

class GeofieldBackendPostgis in Geofield 8

PostgreSQL/PostGIS Backend for Geofield.

Plugin annotation


@GeofieldBackend(
  id = "geofield_backend_postgis",
  admin_label = @Translation("PostGIS Geometry"),
  description = @Translation("Geofield Backend storing values in EWKB Format, suitable for PostgreSQL/PostGIS (needs PostGis enabled)")
)

Hierarchy

Expanded class hierarchy of GeofieldBackendPostgis

File

src/Plugin/GeofieldBackend/GeofieldBackendPostgis.php, line 16

Namespace

Drupal\geofield\Plugin\GeofieldBackend
View source
class GeofieldBackendPostgis extends GeofieldBackendBase {

  /**
   * {@inheritdoc}
   */
  public function schema() {
    return [
      'type' => 'blob',
      'not null' => FALSE,
      'pgsql_type' => 'geometry',
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function save($geometry) {
    $geom = $this->geoPhpWrapper
      ->load($geometry);
    $unpacked = unpack('H*', $geom
      ->out('ewkb'));
    return $unpacked[1];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GeofieldBackendBase::$geoPhpWrapper protected property The geoPhpWrapper service.
GeofieldBackendBase::create public static function Creates an instance of the plugin. Overrides ContainerFactoryPluginInterface::create
GeofieldBackendBase::__construct public function Constructs the GeofieldBackendDefault. Overrides PluginBase::__construct
GeofieldBackendPostgis::save public function Saves the Geo value into the Specific Backend Format. Overrides GeofieldBackendPluginInterface::save
GeofieldBackendPostgis::schema public function Provides the specific database schema for the specific backend. Overrides GeofieldBackendPluginInterface::schema
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition. 1
PluginBase::$pluginId protected property The plugin_id.
PluginBase::DERIVATIVE_SEPARATOR constant A string which is used to separate base plugin IDs from the derivative ID.
PluginBase::getBaseId public function Gets the base_plugin_id of the plugin instance. Overrides DerivativeInspectionInterface::getBaseId
PluginBase::getDerivativeId public function Gets the derivative_id of the plugin instance. Overrides DerivativeInspectionInterface::getDerivativeId
PluginBase::getPluginDefinition public function Gets the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition 3
PluginBase::getPluginId public function Gets the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::isConfigurable public function Determines if the plugin is configurable.