The "geom" property within the Geofield data is a binary object which cannot be serialized to JSON.

This causes a serious issue when using the Services module to retrieve nodes and / or views as JSON. The data cannot be returned as json_encode() fails.

Comments

Brandonian’s picture

Status: Active » Fixed

@dankobiaka, we've recently committed some code in the dev branch that converts our geom column to wkt on load for just such edge cases as this. Let me know if this works for you.

http://drupalcode.org/project/geofield.git/commit/8e4f3f7

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dankobiaka’s picture

I can't confirm the DEV branch fixed this issue. The branch actually caused a lot of other fatal problems (especially related to the GeoPHP auto-format detection) so I had to downgrade immediately.

Brandonian’s picture

@dankobiaka, can you open a separate issue with specifics?

jpstrikesback’s picture

Title: "geom" binary data breaks Services JSON - unable to encode value to JSON » "geom" binary data breaks Services JSON - unable to encode value to JSON -- FOLLOW UP
Status: Closed (fixed) » Needs work

I can confirm that this only fixes the issue for entity updates. When an entity is first saved we still experience issues with services modules that implement hook_node_insert. The reason is that when an entity is first saved and we use hook_field_presave the node object is a reference and it's data is passed exactly as stored if I understand this note from Ryan Szrama correctly.

Field attach API? Thoughts?

giorgio79’s picture

Somewhat related: binary data breaks mongodb migration as well #2022281: Ability to specify Mongo Bin Data for fields Will be testing the dev branch. Hope it fixes the issue.

I think this should be handled by mongodb, but any interim solution would be great. :)

ceepeebee’s picture

due to the binary storage of geom, dpm($view) et al don't work in hook_view_....() either