MatanYadaev / laravel-eloquent-spatial

Laravel Eloquent spatial package.
MIT License
332 stars 49 forks source link

Fix WKT for empty geometry collections #132

Closed LachlanArthur closed 4 days ago

LachlanArthur commented 5 days ago

Empty geometry collections should generate their WKT as GEOMETRYCOLLECTION EMPTY instead of GEOMETRYCOLLECTION()

$empty = new MatanYadaev\EloquentSpatial\Objects\GeometryCollection([], 4326);

$emptyWkt = $empty->toWkt();
// "GEOMETRYCOLLECTION()"

$parsed = MatanYadaev\EloquentSpatial\Objects\Geometry::fromWkt($emptyWkt, 4326);
// InvalidArgumentException: Invalid spatial value.
MatanYadaev commented 4 days ago

Thanks @LachlanArthur!