After sleeping on this, I thought that I don't need to compute the value in the field definition, but do need to remap it in and out of the model, and this indeed allows the field to at last appear on the edit page, with the correct value:
Number::make('Latitude')
->fillUsing(function ($request, $model, $attribute, $requestAttribute) {
$model->location->latitude = (float)$request->input($requestAttribute);
})
->resolveUsing(function ($value, \App\Models\Location $model) {
return $model->location->latitude;
})
This tells me that resolveUsing is doing its job. However, on trying to save, it fails with a JsonEncodingException:
Unable to encode attribute [original] for model [Laravel\Nova\Actions\ActionEvent] to JSON: Malformed UTF-8 characters, possibly incorrectly encoded.
So fillUsing is not working here, and I don't know why a simple float value would cause a JSON encoding issue.