You are here

function openlayers_update_create_projection_table in Openlayers 7.2

Makes projections available that are required for update hooks to work properly. Must by called at least once by any of the update hooks.

3 calls to openlayers_update_create_projection_table()
openlayers_update_7204 in ./openlayers.install
Rename the 'baselayer' in 'isBaseLayer' in layers.
openlayers_update_7206 in ./openlayers.install
Rename the 'base_url' in 'url' in layer type TMS.
openlayers_update_7207 in ./openlayers.install
Migrate configured projections so that other projections than those of EPSG can be used, too.

File

./openlayers.install, line 421
This file holds the functions for the installing and enabling of the openlayers module.

Code

function openlayers_update_create_projection_table() {
  static $hasRun = FALSE;
  if ($hasRun || db_table_exists('openlayers_projections')) {
    return;
  }
  else {
    $hasRun = TRUE;
  }

  // Create projection table
  $openlayers_projections_schema = array(
    'description' => 'Storage for user defined OpenLayers projections.',
    'export' => array(
      'key' => 'identifier',
      'key name' => 'Identifier',
      'primary key' => 'identifier',
      'identifier' => 'openlayers_projections',
      'default hook' => 'openlayers_projections',
      'api' => array(
        'owner' => 'openlayers',
        'api' => 'openlayers_projections',
        'minimum_version' => 1,
        'current_version' => 1,
      ),
    ),
    'fields' => array(
      'identifier' => array(
        'type' => 'varchar',
        'length' => 255,
        'not null' => TRUE,
        'description' => 'Opaque identifier. Guaranteed to be unique but does not have any other meaning.',
      ),
      'authority' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection authority.',
      ),
      'code' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection code.',
      ),
      'definition' => array(
        'type' => 'text',
        'not null' => TRUE,
        'description' => 'Projection definition (proj4 format).',
      ),
      'projectedextentleft' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Leftmost value in this projection's coordinates",
      ),
      'projectedextentbottom' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Bottommost value in this projection's coordinates",
      ),
      'projectedextentright' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Rightmost value in this projection's coordinates",
      ),
      'projectedextenttop' => array(
        'type' => 'numeric',
        'not null' => TRUE,
        'description' => "Topmost value in this projection's coordinates",
      ),
      // TODO Hopefully never used
      'data' => array(
        'type' => 'text',
        'not null' => FALSE,
        'description' => 'Projection data serialized.',
        'serialize' => TRUE,
      ),
    ),
    'primary key' => array(
      'identifier',
    ),
  );
  db_create_table('openlayers_projections', $openlayers_projections_schema);
}