Closed packytagliaferro closed 5 years ago
How odd. Is there any instance of null in the long field? It may be a Nova update (there have been 20+ since I first built this). D
Same here, thats why I switched to POINT field, instead of 2 separete fields.
I am just wondering, how 2 fields should work, since there is no option to use separate lat/lng fields in laravel-mysql-spatial. I meanprotected $spatialFields = [ 'geo_latlon'];
isn't connected in any means with the separate fields lat or long.
When using two seperate lat long fields it does not need to use the spatialfields protected variable.
@bernhardh have you got any more info for me to work with? Could you post a snippet of the migration relevant to these fields and your nova service provider code?
Not sure what would help, but basically I have tried the same as packy..
Map::make('Karte')
->spatialType('LatLon')
->latitude('lat')
->longitude('lng')
->height("300px"),
And thats the field definition of mysql
And thats the complete error:
Ok, found the error - and its basically a documentation error ;)
Use ->spatialType('LatLong')
instead of ->spatialType('LatLon')
and it works.
Ahhh! I'll fix this tonight
I got the map to once again show using @bernhardh solution but still no coordinates. The map lat long is showing as undefined
when I check out the map.js. So the map now just shows some random part of the ocean
Can you maybe provide table definition and the content of the lat/long field of your SQL Table? Btw. "long" is not an ideal name for a column, since its a reserved word in sql.
I can change it to Lon but as of right now:
$table->decimal('lat', 10, 7)->nullable();
$table->decimal('long', 10, 7)->nullable();
Lat: 47.7625209 Long: -116.7858218
It was working a few weeks ago
Ok. I can reproduce your error and have no clue whats wrong.
With ->spatialType('Point') its working
I have MacOS upgrade woes - I will try and work out the issue tomorrow once I am back up and able to run PHP!
Right
return {
type: 'Point',
coordinates: [
this.value[this.longitude_field],
this.value[this.latitude_field],
]
}
This worked before but a change in Nova has broken this. Before this.value gave a js object with all the resources values (including the other fields); Now it doesn't...
It is passed in as a prop
:value="field.value"
and now that is where I see the issue
value: null
Any clues/thoughts before I dive into this tomorrow?
D
OK! I have made a fix! @bernhardh and @packytagliaferro could you pull from dev-master and see if it works before I create a new release?
Thanks
@davidpiesse I can confirm it worked on my setup with
Map::make('Location')
->spatialType('LatLon')
->latitude('lat')
->longitude('long')
->height('300px'),
Awesome I'll push a release tonight
Pushed new release 0.0.4
Sorry for late answer. Yes, now its working. Thank you!
Just recently my map stopped working. On my resource I have
in my model:
my fields
lat
andlong
do have coordinates in them but get the errors: