Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The GeofieldLatLon.php migrate process plugin fails to handle coordinates with zeros, e.g. (0,0) or (51, 0), and returns a NULL instead of the legit coordinates.
Steps to reproduce
Setup a migration with the following migration config (might need a few tweaks to get it working):
id: test
source:
plugin: embedded_data
data_rows:
-
id: 1
lat: 0
lon: 0
ids:
id:
type: integer
process:
body/value:
plugin: geofield_latlon
source:
- lat
- lon
destination:
plugin: entity:node
Result is that the body will have nothing saved in it.
Proposed resolution
Check for. the 0 values before returning a NULL (see patch).
Remaining tasks
Review/test
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Comment | File | Size | Author |
---|---|---|---|
#4 | geofield-correctly-check-zeros-in-migration-3403837-4.patch | 522 bytes | itamair |
Comments
Comment #2
khaled.zaidan CreditAttribution: khaled.zaidan at Full Fat Things commentedAttaching patch for fix.
Comment #3
khaled.zaidan CreditAttribution: khaled.zaidan at Full Fat Things commentedComment #4
itamair CreditAttribution: itamair commentedThanks for reporting this @khaled.zaidan
BUT in Geofield the (0.0) coordinate is not supported, and won't be stored in the Geofield storage.
Patch adjusted to weather allow coordinates with either lat or non not 0.
Committing attached patch into dev, will be part of the next Geofield module release.
Comment #6
itamair CreditAttribution: itamair commented