samedi 14 mars 2015

Drupal Services API - how to include Geometry BLOB value (geofield/geophp)


Vote count:

0




I am creating a custom API in Drupal using the Services module. One of the fields that I'm trying to include in the API results is a geometry location field. The Drupal site uses geofield and geophp. The geom field is stored as a BLOB in the MySQL database.


I have not implemented the geo side of things, so am not very familiar with the code. I want the geometry value (a polygon) in WKT format, so that it can be inserted into an array and returned as JSON/XML via the API


The code I've been trying is



$results = db_query ( 'SELECT atText(l.field_portal_location_geom)
FROM {field_data_field_portal_location} l WHERE
l.entity_id = :eid', array (
':eid' => $eid
) );
$items = $results->fetchAll ();
return $items;


and also looking at the function



geoPHP::load


But I don't know how to implement it properly. All help appreciated!



asked 52 secs ago







Drupal Services API - how to include Geometry BLOB value (geofield/geophp)

Aucun commentaire:

Enregistrer un commentaire