You are here

public function GeofieldBackendPostgis::save in Geofield 8

Saves the Geo value into the Specific Backend Format.

Parameters

mixed|null $geometry: The Geometry to save.

Return value

mixed|null The specific backend format value.

Overrides GeofieldBackendPluginInterface::save

File

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

Class

GeofieldBackendPostgis
PostgreSQL/PostGIS Backend for Geofield.

Namespace

Drupal\geofield\Plugin\GeofieldBackend

Code

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