/[drupal]/contributions/modules/geo/geo.inc
ViewVC logotype

Diff of /contributions/modules/geo/geo.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15, Thu Jun 18 01:24:11 2009 UTC revision 1.16, Mon Nov 9 17:44:40 2009 UTC
# Line 1  Line 1 
1  <?php // $Id: geo.inc,v 1.14 2009/06/10 20:52:03 vauxia Exp $  <?php // $Id: geo.inc,v 1.15 2009/06/18 01:24:11 vauxia Exp $
2    
3  /**  /**
4   * Return the geo backend database type.   * Return the geo backend database type.
# Line 13  function geo_backend_type() { Line 13  function geo_backend_type() {
13      switch ($GLOBALS['db_type']) {      switch ($GLOBALS['db_type']) {
14        case 'pgsql':        case 'pgsql':
15          // use the postgis backend if installed          // use the postgis backend if installed
16          if (db_result(db_query("SELECT 1 FROM pg_catalog.pg_proc          if (db_result(db_query("SELECT 1 FROM pg_catalog.pg_proc
17            WHERE proname = 'postgis_version'"))) {            WHERE proname = 'postgis_version'"))) {
18            $backend = 'postgis';            $backend = 'postgis';
19          }          }
# Line 64  function geo_field_select($field) { Line 64  function geo_field_select($field) {
64    $alias = str_replace('.', '_', $field);    $alias = str_replace('.', '_', $field);
65    $alias = preg_replace('/_geo$/', '', $alias);    $alias = preg_replace('/_geo$/', '', $alias);
66    
67    return " SRID($field) as {$alias}_srid,    return " SRID($field) as {$alias}_srid,
68      AsBinary($field) AS {$alias}_wkb,      AsBinary($field) AS {$alias}_wkb,
69      AsBinary(Envelope($field)) AS {$alias}_bbox,      AsBinary(Envelope($field)) AS {$alias}_bbox,
70      AsBinary(Centroid($field)) AS $alias}_centroid";      AsBinary(Centroid($field)) AS $alias}_centroid";
# Line 261  function geo_gis_input_selector($default Line 261  function geo_gis_input_selector($default
261    return $form;    return $form;
262  }  }
263    
264  function geo_wkt_validate($wkt, $geo_type = NULL, $srid = GEO_DEFAULT_SRID) {  function geo_wkt_validate($wkt, $geo_type = NULL, $srid = GEO_SRID_DEFAULT) {
265    
266    // TODO this should probabaly be moved into db-specific backend files.    // TODO this should probabaly be moved into db-specific backend files.
267    $type = db_result(@db_query("SELECT GeometryType(GeomFromText('%s'))", $wkt));    $type = db_result(@db_query("SELECT GeometryType(GeomFromText('%s'))", $wkt));

Legend:
Removed from v.1.15  
changed lines
  Added in v.1.16

  ViewVC Help
Powered by ViewVC 1.1.2