Closed AGNICO closed 3 years ago
Hi @AGNICO , It is likely if your point is in the Atlantic it is at 0,0 (off the west coast of Africa). This could mean a few things:
The code for a Map field should be
Map::make('Some Point Field', 'point_field_name')
->spatialType('Point'),
I think your 'Empire State Building' field should refer to a DB column / model property.
Let me know what you find out :)
My Model.php
protected $spatialFields = [
'geometry',
'point',
'line_string',
'polygon',
'multi_point',
'multi_line_string',
'multi_polygon',
'geometry_collection'
];
My Nova/Model.php
Map::make('Position', 'point')
->spatialType('Point')
->height('300px'),
My Place.php model:
protected $spatialFields = [
'geometry',
'point',
'line_string',
'polygon',
'multi_point',
'multi_line_string',
'multi_polygon',
'geometry_collection'
];
My DB record (table places): id: 1 name: point geometry: null point: 000000000101000000FBC275D6387F52C0A98020E5CC5F4440 line_string: null other columns also null, only point column is not empty
The map still points to the Atlantic
Hi!
Are you using the Spatial trait from Grimzy? https://github.com/grimzy/laravel-mysql-spatial
such as
class Place extends Model
{
use SpatialTrait;
protected $spatialFields = [
'geometry',
'point'
];
}
yes, of course
Any errors in the console on the front end in Nova? Any way you can confirm it is at Null Island? https://en.wikipedia.org/wiki/Null_Island
No errors in console.
Yes, the map is centered at Null Island, but the point icon is missing.
OK; The default center is [0,0].
If no error is being called then it must be running this.setCenter()
once mounted.
Which means this is where the error/issue starts and the geojson prop is null.
if(this.geojson !== null){
...
}
this means that the value being passed to the map is null or is being left as the default (which is null)
return this.value
The value is set by
<map-detail
:type="field.spatialType"
:value="field.value"
Could you confirm that null is being sent to the page? It is contained within a XHR call /1 (the id of the record) and look into the field resource {resource->fields[x]->value}
I can't see where is it obviously going awry - so hoping to get a bit of insight :)
Yes, resource->fields[:id]->value is null
Also namespace for Model.php is not App\Model.php, but App\Models\Model.php, but I don't think this is an issue.
Anyway, nice package, thank you for your effort, hope we can solve this.
Does your nova resource have the spatialfields property or the Spatial trait? It shouldn't have either.
Whatever is happening is passing a null value to the frontend. Just finding out where...
Nova resource does not have any SpatialTrait. Only 'Model.php' and Place.php have.
@AGNICO is this still an issue? Just catching up on issues :)
Hi, I have problem to display map point. I used default example from LaravelMysqlSpacial:
but if I use in Nova:
The map points somewhere to the middle of Atlantic ocean and point is not displayed.
'point' column in DB has value : 000000000101000000FBC275D6387F52C0A98020E5CC5F4440