laravel-mysql-spatial icon indicating copy to clipboard operation
laravel-mysql-spatial copied to clipboard

Not able to update geometry field with MultiPoint

Open sookoll opened this issue 3 years ago • 1 comments

private array $locations = [];
...
$this->locations[] = new Point($y, $x);
...
DB::table('table')->whereId($id)->update(['location' => new MultiPoint($this->locations)]);

Error: SQLSTATE[22003]: Numeric value out of range: 1416 Cannot get geometry object from data you send to the GEOMETRY field (SQL: update table set location = (647298.25 6461126.89),(647550.63 6460742.56) where id = 1)

In what world this SQL is valid SQL? Did I missed something and it should work some other way that documentation do not mention?

sookoll avatar Feb 01 '22 15:02 sookoll

Did you add location to the $spatialFields property?

sikhlana avatar Feb 22 '22 12:02 sikhlana