I am creating a POST request to add geospatial content. I have a field of type "Geofield" (provided by Geocoder module. I don't know how to represent it in JSON.

Tried:

field_geofield":{"value":"33.37079,35.130351"},

Getting:

Unprocessable Entity: validation failed.
field_geofield.0.value: "33.37079,35.130351" is not a valid geospatial content.

Also tried:

 "field_geofield":{"value":"POINT (33.37079,35.130351)"},

With the same result:

Unprocessable Entity: validation failed.
field_geofield.0.value: "POINT (33.37079,35.130351)" is not a valid geospatial content.

Do anyone know the right syntax for populating a  Geofield with POST?

Comments

gisle’s picture

The correct syntax is:

"field_geofield":{"value":"POINT (33.37079 35.130351)"},

Space, not comma between the latitude and longitude.

- gisle