When I enter the following value into a geofield: POINT (13.375017851383 52.50967395), this geohash is computed: u33d8r57h88nhbz4u4vj.

This leads to the following SQL exception, when I try to save the respective entity:

SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_location_geohash'

I am not sure whether the geohash is still a valid geohash at that length (i.e. this might be a bug with geophp?), or whether the column should allow longer values.

Either way, the error disappears when I reduce the number of decimals in the coordinate components to 6 or 7, i.e. POINT (13.375017 52.509673). This is most likely still precise enough, and maybe something that could be done automatically before stuff is stored in the database...

Any thoughts? :)

Comments

  • plopesc committed ad47448 on 8.x-1.x
    Issue #2382515: SQL Exception when saving fields with long geohash
    
plopesc’s picture

Status: Active » Fixed

This should be fixed in -dev.

Thank you for reporting this!

Status: Fixed » Closed (fixed)

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