From ad4a0cc7d4afe1389aee7e631483e4ee9d21738a Mon Sep 17 00:00:00 2001 From: Greg Sebastian Date: Wed, 29 Nov 2017 23:49:54 -0800 Subject: [PATCH 1/5] Beginning to rewrite geospatial with my own ogr2ogr class, multipage load processing for bulkAPI, and ability to process KML --- geospatial.module | 12 +- includes/ogr2ogr.inc | 134 ++++++++++++++++++ .../spatial_file.inc | 0 plugins/geocoder_handler/spatial_file.inc | 87 ++++++++++++ .../{shapefile.inc => spatial_file.inc~} | 58 ++++---- 5 files changed, 261 insertions(+), 30 deletions(-) create mode 100644 includes/ogr2ogr.inc rename geospatial_shapefile.class.inc => includes/spatial_file.inc (100%) create mode 100644 plugins/geocoder_handler/spatial_file.inc rename plugins/geocoder_handler/{shapefile.inc => spatial_file.inc~} (98%) diff --git a/geospatial.module b/geospatial.module index c47d77e..589ccdb 100644 --- a/geospatial.module +++ b/geospatial.module @@ -11,9 +11,19 @@ /** * Implements hook_ctools_plugin_directory - * + * * Tell ctools where to find plugins. */ function geospatial_ctools_plugin_directory($owner, $plugin_type) { return 'plugins/' . $plugin_type; } + + +/** + * Get the ogr2ogr path... + */ +function get_ogr2ogr_bin_path() { + // If the ogr2ogr variable hasn't been configured, attempt to find it with `which`. + $path = variable_get('geospatial_ogr2ogr_path', exec('which ogr2ogr')); + return $path; +} diff --git a/includes/ogr2ogr.inc b/includes/ogr2ogr.inc new file mode 100644 index 0000000..25a1dc0 --- /dev/null +++ b/includes/ogr2ogr.inc @@ -0,0 +1,134 @@ +ogr2ogr_bin = geospatial_get_ogr2ogr_path(); + + // Create tmp directory + $tmpdir = tempnam(sys_get_temp_dir(), 'mapshape'); + unlink($tmpdir); + mkdir($tmpdir); + $this->tmpdir = $tmpdir; + $this->uri = $uri; + + $this->ogr2ogr_files = array(); // Zip files may contain multiple kmls or shps. + $this->current_file_index = 0; + } + + private function extract() { + $zippath = drupal_realpath($this->uri); + $zip = new ArchiverZip($zippath); + $zip->extract($this->tmpdir); + } + + private function find_files($type) { + return file_scan_directory($this->tmpdir, '/^.*\.(' . $type . ')$/') + } + + function prepare() { + $urlinfo = parse_url($this->uri); + $fileinfo = pathinfo($urlinfo['path']); + $extension = $fileinfo['extension']; + + if (in_array($extension, array('zip', 'shpz'))) { + $this->extract(); + $shapefiles = $this->find_files('shp'); + + foreach ($shapefiles as $shp) { + $this->run_ogr2ogr($shp->uri); + } + } elseif ($extension == 'kmz') { + $this->extract(); + $kml_files = $this->find_files('kml'); + + foreach ($kml_files as $kml) { + $this->run_ogr2ogr($kml->uri); + } + } elseif ($extension == 'kml') { + $this->run_ogr2ogr(drupal_realpath($this->uri)); + } + } + + /** + * Convert a spatial file into a CSV with WKT Geometries, and store it in the ogr2ogr_files property for later. + */ + private function run_ogr2ogr($uri) { + // Figure out what the csv will be called. + $csv_name = 'shape' . count($this->ogr2ogr_files) . '.csv'; + + // Convert shapefile into a csv file + $command = $this->ogr2ogr_bin . " -f csv -t_srs 'EPSG:4326' -lco GEOMETRY=AS_WKT " . $this->tmpdir . '/ogr2ogr/' . $csv_name . ' ' . $uri; + system(escapeshellcmd($command)); + + array_push($this->ogr2ogr_files, $this->tmpdir . '/ogr2ogr/' . $csv_name); + } + + private function open() { + if (file_exists($this->ogr2ogr_files[$this->current_file_index]) && $this->csv = fopen($this->ogr2ogr_files[$this->current_file_index], 'r')) { + return TRUE; + } else { + return FALSE; + } + } + + /** + * This method may be used to reopen the current file and seek to the previous location when continuing + * the processing over multiple page loads. + */ + function reopen() { + $was_opened = $this->open(); + fseek($this->csv, $this->pointer); + + return $was_opened; + } + + function fgetcsv() { + $data = fgetcsv($this->csv); + $this->pointer = ftell($this->csv); + + if ($data) { + return $data; // In most cases this is as far as we'll get. + + } else { // $data returned false.. Attempt to open the next file in the list and return the first line. + $next_file = $this->open(++$this->current_file_index); + + if ($next_file) { + // Let's automatically skip the headers. + fgetcsv($this->csv); + + // Then return the first line in the next csv. + $data = fgetcsv($this->csv); + $this->pointer = ftell($this->csv); + return $data; + + } else { + // There was no next file to open... + return FALSE; + } + } + } + + /** + * We use this close() method instead of __destruct() because this class is designed to be able + * to persist through multiple page loads so as to be usable with the bulk API. As such we do not + * want to delete the files generated by this instance until we know we are finished. At that point + * we might as well close the CSV generated by ogr2ogr at the same time as cleaning generated files. + */ + function close() { + @fclose($this->csv); + + // Remove all files created by this instance. + file_unmanaged_delete_recursive($this->tmpdir); + } +} diff --git a/geospatial_shapefile.class.inc b/includes/spatial_file.inc similarity index 100% rename from geospatial_shapefile.class.inc rename to includes/spatial_file.inc diff --git a/plugins/geocoder_handler/spatial_file.inc b/plugins/geocoder_handler/spatial_file.inc new file mode 100644 index 0000000..32188d4 --- /dev/null +++ b/plugins/geocoder_handler/spatial_file.inc @@ -0,0 +1,87 @@ + t("Spatial file"), + 'description' => t('Get the geometry out of a spatially enabled file, such as kml, kmz, or shpz.'), + 'callback' => 'geospatial_spatial_file', + 'field_types' => array('file'), + 'field_callback' => 'geospatial_spatial_file_field', +); + +/** + * Process Markup + */ +function geospatial_spatial_file($wkt_features, $options = array()) { + geophp_load(); + $store_features = array(); + $wkt = array(); + + foreach ($wkt_features as $wkt_feature) { + if (!isset($wkt_feature['WKT']) || empty($wkt_feature)) { + continue; + } + $store_features[] = $wkt_feature['WKT']; + } + if ($store_features) { + // If there is more than one value to save, wrap in GeometryCollection + if (isset($store_features[1])) { + $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $store_features))); + } + else { + $wkt = array('wkt' => $store_features[0]); + } + } + + return geoPHP::load($wkt['wkt'], 'wkt'); +} + +function geospatial_spatial_file_field($field, $field_item) { + if ($field['type'] == 'file') { + if ($field_item['fid']) { + $file = file_load($field_item['fid']); + //$data = file_get_contents($file->uri); + $features = geospatial_spatial_file_get_wkt($file->uri); + //$features = geospatial_file_parse_wkt_features($features); + + return geospatial_spatial_file($features); + } else { + //if there's no file we want to put an empty value into the field. + return geospatial_spatial_file(array()); + } + } else { + // Something has gone wrong... + } +} + +/** + * extract geodata from spatial_file. + */ +function geospatial_spatial_file_get_wkt($spatial_file_uri) { + if ($spatial_file = geospatial_spatial_file_open($spatial_file_uri)) { + if ($spatial_features = $spatial_file->process()) { + return $spatial_features; + } + } + + return NULL; +} + +/** + * Open a stream to a Spatial_File + */ +function geospatial_spatial_file_open($uri) { + module_load_include('inc', 'geospatial', 'geospatial_spatial_file.class'); + if ($spatial_file = new SpatialSpatial_File($uri)) { + return $spatial_file; + } +} diff --git a/plugins/geocoder_handler/shapefile.inc b/plugins/geocoder_handler/spatial_file.inc~ similarity index 98% rename from plugins/geocoder_handler/shapefile.inc rename to plugins/geocoder_handler/spatial_file.inc~ index d6745d3..1b927f4 100644 --- a/plugins/geocoder_handler/shapefile.inc +++ b/plugins/geocoder_handler/spatial_file.inc~ @@ -25,23 +25,23 @@ function geospatial_shapefile($wkt_features, $options = array()) { geophp_load(); $store_features = array(); $wkt = array(); - - foreach ($wkt_features as $wkt_feature) { - if (!isset($wkt_feature['WKT']) || empty($wkt_feature)) { - continue; - } - $store_features[] = $wkt_feature['WKT']; + + foreach ($wkt_features as $wkt_feature) { + if (!isset($wkt_feature['WKT']) || empty($wkt_feature)) { + continue; + } + $store_features[] = $wkt_feature['WKT']; } - if ($store_features) { - // If there is more than one value to save, wrap in GeometryCollection - if (isset($store_features[1])) { - $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $store_features))); - } - else { - $wkt = array('wkt' => $store_features[0]); - } + if ($store_features) { + // If there is more than one value to save, wrap in GeometryCollection + if (isset($store_features[1])) { + $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $store_features))); + } + else { + $wkt = array('wkt' => $store_features[0]); + } } - + return geoPHP::load($wkt['wkt'], 'wkt'); } @@ -52,7 +52,7 @@ function geospatial_shapefile_field($field, $field_item) { //$data = file_get_contents($file->uri); $features = geospatial_shapefile_get_wkt($file->uri); //$features = geospatial_file_parse_wkt_features($features); - + return geospatial_shapefile($features); } else { //if there's no file we want to put an empty value into the field. @@ -66,22 +66,22 @@ function geospatial_shapefile_field($field, $field_item) { /** * extract geodata from shapefile. */ -function geospatial_shapefile_get_wkt($shapefile_uri) { - if ($shapefile = geospatial_shapefile_open($shapefile_uri)) { - if ($spatial_features = $shapefile->process()) { - return $spatial_features; - } - } - - return NULL; +function geospatial_shapefile_get_wkt($shapefile_uri) { + if ($shapefile = geospatial_shapefile_open($shapefile_uri)) { + if ($spatial_features = $shapefile->process()) { + return $spatial_features; + } + } + + return NULL; } -/** - * Open a stream to a Shapefile - */ -function geospatial_shapefile_open($uri) { +/** + * Open a stream to a Shapefile + */ +function geospatial_shapefile_open($uri) { module_load_include('inc', 'geospatial', 'geospatial_shapefile.class'); if ($shapefile = new SpatialShapefile($uri)) { return $shapefile; - } + } } From 1d658632ed2c0bb7229752866725358a27d02898 Mon Sep 17 00:00:00 2001 From: Greg Sebastian Date: Thu, 30 Nov 2017 00:16:59 -0800 Subject: [PATCH 2/5] In theory that should be the working version. --- includes/spatial_file.inc | 42 +++++++---------------- plugins/geocoder_handler/spatial_file.inc | 33 ++++-------------- 2 files changed, 19 insertions(+), 56 deletions(-) diff --git a/includes/spatial_file.inc b/includes/spatial_file.inc index c36ffd8..d944d29 100644 --- a/includes/spatial_file.inc +++ b/includes/spatial_file.inc @@ -4,39 +4,23 @@ * Could also look at parsing shapefiles manually: http://en.wikipedia.org/wiki/Shapefile#Shapefile_shape_format_.28.shp.29 * Could also implement Iterator: http://php.net/manual/en/class.iterator.php */ -class SpatialShapefile { - var $extracted_path = ''; - var $uri = ''; +function parse_wkt_from_spatial_file($uri) { + module_load_include('inc', 'geospatial', 'includes/ogr2ogr'); + $wkt_values = array(); - function __construct($uri) { - $this->uri = $uri; - $this->extracted_path = drupal_realpath('temporary://spatial_shapefile_'. basename($this->uri, '.zip')); + $ogr2ogr = new ogr2ogr($uri); - // Unzip. - $zip = new ArchiverZip(drupal_realpath($this->uri)); - $zip->extract($this->extracted_path); - } - - function __destruct() { - // Delete extracted folder. - file_unmanaged_delete_recursive($this->extracted_path); - } + // Check the file type, extract any relevant files, and run ogr2ogr. + $ogr2ogr->prepare(); - function process() { - $result = array(); + // Attempt to open the CSV created by ogr2ogr + if ($ogr2ogr->open()) { + $header = $ogr2ogr->fgetcsv(); + $wkt_key = array_search('WKT', $header); - // Look for shapefiles. - $shapefiles = file_scan_directory($this->extracted_path, '/^.*\.(shp)$/'); - - foreach ($shapefiles as $shapefile) { - if ($ogr2ogr_shapefile = ogr2ogr_open($shapefile->uri)) { - if ($spatial_features = $ogr2ogr_shapefile->getWkt()) { - $result = array_merge($result, $spatial_features); - } - } + while ($row = $ogr2ogr->fgetcsv()) { + array_push($wkt_values, $row[$wkt_key]); } - - return $result; } - + return $wkt_values; } diff --git a/plugins/geocoder_handler/spatial_file.inc b/plugins/geocoder_handler/spatial_file.inc index 32188d4..6a45893 100644 --- a/plugins/geocoder_handler/spatial_file.inc +++ b/plugins/geocoder_handler/spatial_file.inc @@ -26,19 +26,13 @@ function geospatial_spatial_file($wkt_features, $options = array()) { $store_features = array(); $wkt = array(); - foreach ($wkt_features as $wkt_feature) { - if (!isset($wkt_feature['WKT']) || empty($wkt_feature)) { - continue; - } - $store_features[] = $wkt_feature['WKT']; - } - if ($store_features) { + if ($wkt_features) { // If there is more than one value to save, wrap in GeometryCollection - if (isset($store_features[1])) { - $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $store_features))); + if (isset($wkt_features[1])) { + $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $wkt_features))); } else { - $wkt = array('wkt' => $store_features[0]); + $wkt = array('wkt' => $wkt_features[0]); } } @@ -67,21 +61,6 @@ function geospatial_spatial_file_field($field, $field_item) { * extract geodata from spatial_file. */ function geospatial_spatial_file_get_wkt($spatial_file_uri) { - if ($spatial_file = geospatial_spatial_file_open($spatial_file_uri)) { - if ($spatial_features = $spatial_file->process()) { - return $spatial_features; - } - } - - return NULL; -} - -/** - * Open a stream to a Spatial_File - */ -function geospatial_spatial_file_open($uri) { - module_load_include('inc', 'geospatial', 'geospatial_spatial_file.class'); - if ($spatial_file = new SpatialSpatial_File($uri)) { - return $spatial_file; - } + module_load_include('inc', 'geospatial', 'includes/spatial_file'); + return parse_wkt_from_spatial_file($spatial_file_uri); } From e75174c2c08f5a37342525bb73072ce670454d23 Mon Sep 17 00:00:00 2001 From: Greg Sebastian Date: Thu, 30 Nov 2017 10:19:32 -0800 Subject: [PATCH 3/5] Small fixes before testing --- geospatial.info | 3 +-- includes/spatial_file.inc | 2 ++ plugins/geocoder_handler/spatial_file.inc | 1 - 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/geospatial.info b/geospatial.info index f89a49b..2a501ed 100644 --- a/geospatial.info +++ b/geospatial.info @@ -1,7 +1,6 @@ name = GeoSpatial -description = An adaption of Affinity Bridge's spatial7 module that provides a geocoder handler for shapefiles. +description = "An adaption of Affinity Bridge's spatial7 module that provides a geocoder handler for shapefiles." package = Geo Spatial Tools core = 7.x -dependencies[] = ogr2ogr dependencies[] = geocoder dependencies[] = file diff --git a/includes/spatial_file.inc b/includes/spatial_file.inc index d944d29..f82aaec 100644 --- a/includes/spatial_file.inc +++ b/includes/spatial_file.inc @@ -22,5 +22,7 @@ function parse_wkt_from_spatial_file($uri) { array_push($wkt_values, $row[$wkt_key]); } } + + $ogr2ogr->close(); return $wkt_values; } diff --git a/plugins/geocoder_handler/spatial_file.inc b/plugins/geocoder_handler/spatial_file.inc index 6a45893..6f303db 100644 --- a/plugins/geocoder_handler/spatial_file.inc +++ b/plugins/geocoder_handler/spatial_file.inc @@ -23,7 +23,6 @@ $plugin = array( */ function geospatial_spatial_file($wkt_features, $options = array()) { geophp_load(); - $store_features = array(); $wkt = array(); if ($wkt_features) { From 3ad171a1a2da6a57aa3069896ee305aa76b01fd6 Mon Sep 17 00:00:00 2001 From: Greg Sebastian Date: Thu, 30 Nov 2017 11:58:23 -0800 Subject: [PATCH 4/5] Added a settings page for ogr2ogr --- geospatial.info | 4 ++-- geospatial.module | 29 +++++++++++++++++++++++++++++ includes/geospatial.admin.inc | 28 ++++++++++++++++++++++++++++ 3 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 includes/geospatial.admin.inc diff --git a/geospatial.info b/geospatial.info index 2a501ed..d56d2d5 100644 --- a/geospatial.info +++ b/geospatial.info @@ -1,6 +1,6 @@ name = GeoSpatial -description = "An adaption of Affinity Bridge's spatial7 module that provides a geocoder handler for shapefiles." -package = Geo Spatial Tools +description = "Tools for processing spatial files. Includes a geocoder handler." core = 7.x dependencies[] = geocoder dependencies[] = file +version = 7.x-2.x-dev diff --git a/geospatial.module b/geospatial.module index 589ccdb..9bf4b93 100644 --- a/geospatial.module +++ b/geospatial.module @@ -18,6 +18,35 @@ function geospatial_ctools_plugin_directory($owner, $plugin_type) { return 'plugins/' . $plugin_type; } +/** + * Implements hook_permission(). + */ +function geospatial_permission() { + return array( + 'administer geospatial' => array( + 'title' => t('Administer GeoSpatial'), + 'description' => t('Access administration pages and settings related to the GeoSpatial module.'), + ), + ); +} + +/** + * Implement hook_menu(). + */ +function geospatial_menu() { + $items = array(); + + $items['admin/config/content/geospatial'] = array( + 'title' => 'GeoSpatial', + 'description' => 'Configure GeoSpatial settings and ogr2ogr options.', + 'page callback' => 'drupal_get_form', + 'page arguments' => array('geospatial_admin_settings'), + 'access arguments' => array('administer geospatial'), + 'file' => 'includes/geospatial.admin.inc', + ); + + return $items; +} /** * Get the ogr2ogr path... diff --git a/includes/geospatial.admin.inc b/includes/geospatial.admin.inc new file mode 100644 index 0000000..5f17de4 --- /dev/null +++ b/includes/geospatial.admin.inc @@ -0,0 +1,28 @@ + 'fieldset', + '#title' => t('ogr2ogr'), + '#collapsible' => TRUE, + '#collapsed' => FALSE, + ); + + $form['ogr2ogr']['geospatial_ogr2ogr_path'] = array( + '#type' => 'textfield', + '#title' => t('Path'), + '#description' => t('GeoSpatial will attempt to locate the ogr2ogr binary automatically, however the process of doing so is not reliable. Please set the value here.'), + '#default_value' => variable_get('geospatial_ogr2ogr_path', exec('which ogr2ogr')), + ); + + return system_settings_form($form); +} From f5971d0671d7c1592251f2f67966b5060b6e76d4 Mon Sep 17 00:00:00 2001 From: Greg Sebastian Date: Mon, 18 Dec 2017 11:34:36 -0800 Subject: [PATCH 5/5] Debugging and tidy up. --- geospatial.module | 10 +++++++++- includes/ogr2ogr.inc | 20 +++++++++----------- includes/spatial_file.inc | 2 +- plugins/geocoder_handler/spatial_file.inc | 8 ++++---- 4 files changed, 23 insertions(+), 17 deletions(-) diff --git a/geospatial.module b/geospatial.module index 9bf4b93..b79ecf2 100644 --- a/geospatial.module +++ b/geospatial.module @@ -51,8 +51,16 @@ function geospatial_menu() { /** * Get the ogr2ogr path... */ -function get_ogr2ogr_bin_path() { +function geospatial_get_ogr2ogr_bin_path() { // If the ogr2ogr variable hasn't been configured, attempt to find it with `which`. $path = variable_get('geospatial_ogr2ogr_path', exec('which ogr2ogr')); return $path; } + +/** + * Public wrapper function around the spatial file parsing function + */ +function geospatial_parse_wkt_from_spatial_file($uri) { + module_load_include('inc', 'geospatial', 'includes/spatial_file'); + return _geospatial_parse_wkt_from_spatial_file($uri); +} diff --git a/includes/ogr2ogr.inc b/includes/ogr2ogr.inc index 25a1dc0..6230438 100644 --- a/includes/ogr2ogr.inc +++ b/includes/ogr2ogr.inc @@ -4,21 +4,20 @@ * * @todo Restore bulk API compatibility. It was lost when adding the ability to process multi layered zips. */ - class ogr2ogr { - private $tmpdir; - private $type; - private $pointer; - public $csv; +// private $tmpdir; +// private $type; +// private $pointer; +// public $csv; function __construct($uri) { // Get ogr2ogr bin - $this->ogr2ogr_bin = geospatial_get_ogr2ogr_path(); + $this->ogr2ogr_bin = geospatial_get_ogr2ogr_bin_path(); // Create tmp directory $tmpdir = tempnam(sys_get_temp_dir(), 'mapshape'); - unlink($tmpdir); - mkdir($tmpdir); + unlink($tmpdir); // If this tmpdir exists already for some reason... remove it. + mkdir($tmpdir . "/ogr2ogr", 0777, TRUE); $this->tmpdir = $tmpdir; $this->uri = $uri; @@ -33,7 +32,7 @@ class ogr2ogr { } private function find_files($type) { - return file_scan_directory($this->tmpdir, '/^.*\.(' . $type . ')$/') + return file_scan_directory($this->tmpdir, "/^.*\.(" . $type . ")$/"); } function prepare() { @@ -74,7 +73,7 @@ class ogr2ogr { array_push($this->ogr2ogr_files, $this->tmpdir . '/ogr2ogr/' . $csv_name); } - private function open() { + function open() { if (file_exists($this->ogr2ogr_files[$this->current_file_index]) && $this->csv = fopen($this->ogr2ogr_files[$this->current_file_index], 'r')) { return TRUE; } else { @@ -127,7 +126,6 @@ class ogr2ogr { */ function close() { @fclose($this->csv); - // Remove all files created by this instance. file_unmanaged_delete_recursive($this->tmpdir); } diff --git a/includes/spatial_file.inc b/includes/spatial_file.inc index f82aaec..c1dd523 100644 --- a/includes/spatial_file.inc +++ b/includes/spatial_file.inc @@ -4,7 +4,7 @@ * Could also look at parsing shapefiles manually: http://en.wikipedia.org/wiki/Shapefile#Shapefile_shape_format_.28.shp.29 * Could also implement Iterator: http://php.net/manual/en/class.iterator.php */ -function parse_wkt_from_spatial_file($uri) { +function _geospatial_parse_wkt_from_spatial_file($uri) { module_load_include('inc', 'geospatial', 'includes/ogr2ogr'); $wkt_values = array(); diff --git a/plugins/geocoder_handler/spatial_file.inc b/plugins/geocoder_handler/spatial_file.inc index 6f303db..3e4bd39 100644 --- a/plugins/geocoder_handler/spatial_file.inc +++ b/plugins/geocoder_handler/spatial_file.inc @@ -28,14 +28,14 @@ function geospatial_spatial_file($wkt_features, $options = array()) { if ($wkt_features) { // If there is more than one value to save, wrap in GeometryCollection if (isset($wkt_features[1])) { - $wkt = array('wkt' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $wkt_features))); + $wkt = array('geom' => sprintf('GEOMETRYCOLLECTION(%s)', implode(',', $wkt_features))); } else { - $wkt = array('wkt' => $wkt_features[0]); + $wkt = array('geom' => $wkt_features[0]); } } - return geoPHP::load($wkt['wkt'], 'wkt'); + return geoPHP::load($wkt['geom'], 'wkt'); } function geospatial_spatial_file_field($field, $field_item) { @@ -61,5 +61,5 @@ function geospatial_spatial_file_field($field, $field_item) { */ function geospatial_spatial_file_get_wkt($spatial_file_uri) { module_load_include('inc', 'geospatial', 'includes/spatial_file'); - return parse_wkt_from_spatial_file($spatial_file_uri); + return _geospatial_parse_wkt_from_spatial_file($spatial_file_uri); }