As of an upcoming (or recent?) commit, Geo will no longer return wkt in its fields by default.

Originally, I had included the wkt column in CCK database definitions for my own clarity and for some fail-safe measures. It was originally believed that all of Drupal's GIS modules would communicate in this format, so I included it by default.

When formatters began requiring other formats, it became unscalable to manage the WKT values. Some formatters need commas between lat/lon, some need them between point sets, some need lon/lat, and so-on. The act of parsing and preging WKT became ridiculous.

Thus, I began retrieving the data in WKB format, and streaming its conversion via the functions found in the includes/geo.wkb.inc file. I'm now deprecating this functionality and using geo_wkb_get_data() to convert the WKB into an acceptable format for your formatters.

Going further, I don't want formatter maintainers to have to call this function directly, because I think that's hokey and a little inconsistent. It also means that Geo is *required* by your module, which need not be the case.

Instead, you should overload hook_field_formatter_info() with the following:

OLD:

function openlayers_cck_field_formatter_info() {
  return array(
    'openlayersmapformatter_single' => array(
      'label' => t('OpenLayers Single Map'),
      'field types' => array('geo'),
      'multiple values' => CONTENT_HANDLE_MODULE,
    ),
  );
}

NEW:

function openlayers_cck_field_formatter_info() {
  return array(
    'openlayersmapformatter_single' => array(
      'label' => t('OpenLayers Single Map'),
      'field types' => array('geo', 'geo_data'),
      'multiple values' => CONTENT_HANDLE_MODULE,
      'gis input' => 'wkt',
      'gis types' => array('point', 'linestring', 'polygon'),
    ),
  );
}

This will guarantee that you have a 'wkt' element (or whatever you decide to define for 'gis input') in your #item entry. The 'gis types' element is presently unused, but will possibly accommodate the filtering of choices on the formatters selection.

I'm also including 'geo data' as an available field type.

CommentFileSizeAuthor
openlayers_hook_gis_input.patch477 bytesallie micka

Comments

zzolo’s picture

Allie,

Thanks for the heads up on the change and the code. Hopefully we can update this soon.

--
zzolo

zzolo’s picture

Status: Active » Closed (fixed)

* OpenLayers - Geo integration stalled, closing