Data too long for location field

Created on 14 December 2023, 11 months ago
Updated 4 July 2024, 4 months ago

NOTE: I mistakenly posted this in Geocoder when it's a Geofield issue. Duh.

https://www.drupal.org/project/geocoder/issues/3408625 💬 Data too long for location field Closed: works as designed

Effectively the same issue as posted at https://www.drupal.org/project/geocoder/issues/3355171 💬 Data too long for column Closed: works as designed - in this case, the data is, indeed, too long.

I've been pasting GeoJSON data directly into the Location field in Geofield - for this particular region (a Congressional district) there's evidently just too much data. (This is boundary, not point data.)

The error is:

Drupal\Core\Entity\EntityStorageException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_map_location_value' - see https://www.drupal.org/project/geocoder/issues/3355171 💬 Data too long for column Closed: works as designed for more details.

This works fine for other regions with less data. I'll also mention here that once saved, the Location field just contains a string of numbers and nothing else, although it works fine.

Can Geofield be set up to read directly from a file? Is there any way to increase the field capacity? Thanks in advance for any suggestions...

UPDATE:

Here's a link to the actual geodata:

https://icrmedia.com/sites/default/files/map-data/CD1_working.json

You can see that it tests fine in geojson.io, but doesn't work in Geofield. I'll offer a bounty to fix this - feel free to reach out. Thanks in advance!

💬 Support request
Status

Closed: outdated

Version

1.57

Component

Miscellaneous

Created by

🇺🇸United States bcobin

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @bcobin
  • 🇺🇸United States bcobin
  • 🇺🇸United States bcobin

    I'll also mention here that once saved, the Location field just contains a string of numbers and nothing else, although it works fine.

    Duh. If the input is set to Leaflet Map, the data formats fine, so ignore that. But otherwise...

    Looking further into this, I don't believe it's a storage issue, per se. Here's the error message:

    Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'field_location_value' at row 1: INSERT INTO "node__field_location" ("entity_id", "revision_id", "bundle", "delta", "langcode", "field_location_value", "field_location_geo_type", "field_location_lat", "field_location_lon", "field_location_left", "field_location_top", "field_location_right", "field_location_bottom", "field_location_geohash") VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12, :db_insert_placeholder_13); Array ( [:db_insert_placeholder_0] => 5 [:db_insert_placeholder_1] => 71 [:db_insert_placeholder_2] => region [:db_insert_placeholder_3] => 0 [:db_insert_placeholder_4] => en [:db_insert_placeholder_5] => 010600000020000000010300000001000000a80300005136e2da961e52c051202a39cd6b4440ea408f649d1e52c0868c12c6e86b4440133e6b56a11e52c03a8ab114f76b44406f847235a31e52c054de79b9f86b4440fb1ef67ba41e52c03e94b43ff96b4440ce8e5e31a61e52c086f4e89ef86b4440e9f78bdcaa1e52c009ff7071...
    
    (This string goes on for pages and pages - no wonder the system refuses to store it.)
    
    [continued] 
    
    [:db_insert_placeholder_6] => MultiPolygon [:db_insert_placeholder_7] => 41.023295607948 [:db_insert_placeholder_8] => -72.676583405565 [:db_insert_placeholder_9] => -73.497092807085 [:db_insert_placeholder_10] => 41.295312500864 [:db_insert_placeholder_11] => -71.856074004036 [:db_insert_placeholder_12] => 40.751278715027 [:db_insert_placeholder_13] => dr ) in Drupal\Core\Entity\Sql\SqlContentEntityStorage->saveToDedicatedTables() (line 1400 of /home/suffolk/d1024/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
    Severity	Error

    Al the other .json on the site works fine, so I suspected a problem with the data, but the data checks out everywhere. The problem is with [:db_insert_placeholder_5] (location value) as the error message indicates and it's only on this particular region, out of dozens that are working fine.

    Any ideas? Suggestions greatly appreciated...

  • 🇺🇸United States bcobin

    My host (imageleet.com) figured this out:

    Storage issue is due to field_location_value column defined as blob in table field_location which limit the data to 64 Kb, If its defined the mediumblob during module installation then large location data can be uploaded if required.

    By updating the field storage, up to 64MB can be stored, thus solving the problem:

    Storage type update should work for all region as now data up to 64 MB can be uploaded.

  • Status changed to Needs review 5 months ago
  • 🇮🇹Italy itamair

    Actually the Geofield value field is generated in the MySql Db as a LONGBLOB ...
    So I don't think this is a real issue. Could we close this?

  • Status changed to Closed: outdated 4 months ago
Production build 0.71.5 2024