Closed tanabi closed 1 year ago
If anyone gets this error and needs a workaround for right now, this code will do it:
// Workaround for MagellanGeography bug
// https://github.com/clickbar/laravel-magellan/issues/27
Grammar::macro('typeMagellanFix', function() {
return 'GEOGRAPHY(POINT, 4326)';
});
$table->addColumn('magellanFix', 'location');
//$table->magellanGeography('location', 4326); // 4326 is srid
Oh, seems like an issue with the grammar function indeed.
Thank you very much for reporting the issue!
We will take a closer look asap and get a fix out.
And your workaround should be equal to
$table->magellanPoint('location', 4326, 'GEOGRAPHY');
If you want to allow any geography for the column, i believe you will need to do this:
// Workaround for MagellanGeography bug
// https://github.com/clickbar/laravel-magellan/issues/27
Grammar::macro('typeMagellanFix', function() {
return 'GEOGRAPHY';
});
$table->addColumn('magellanFix', 'location');
I just need points at the moment. I think your suggestion of using magellanPoint will work for me and avoid having to do a kind of weird workaround, thanks for showing me how to do that :) And thanks for jumping on the issue!
Hey there;
When trying to use magellanGeography as a column type, such as:
I get an error such as:
I believe the problem is that it should be public.GEOGRAPHY(POINT, 4326) not null (replace POINT with whatever object you wish to use) instead of public.GEOGRAPHY(GEOGRAPHY, 4326). When I take the SQL generated above and replace it with my recommendation, the create table works.
Therefore, I believe magellanGeography should take a third parameter which is the geometry type you want to use with the geography.