Closed docuracy closed 7 months ago
Questions:
form.geojson
value always going to be null for this page? If so, the AreaCreateView
should not be dealing with forms, and nor should area_create.html
be dealing with form values. I suspect that forms are needed only for AreaUpdateView
. Nevertheless, I'll code the map_init
function of areas.js
to load any passed GeoJSON because I suspect that the same areas.js
module will be used for that.bootstrap.bundle.min.js
. I've hard-coded it in, but suspect that it's been inadvertently deleted from main/base.html
and so will be missing from other pages too.TO DO
/areas/views.py
sets self.success_url = '/mystudyareas'
, but that url is commented out in `/urls.py'.KG: "The success url should be /dashboard
...
In v2, a simple polygon hull is computed whether a buffer is requested or not, and its that geometry written to the geojson form field and saved to the Area record. As you have it now, a FeatureCollection appears there. When the page is refreshed as an edit page, a count_public @property on the Area model is consulted to display the number of place records that lie within it. It can’t convert the FeatureCollection in this line:
areageom = GEOSGeometry(json.dumps(self.geojson))
But a further issue is, ... what about multiple discontinuous areas making up a study area?"
SG: In areas.js
the native MapLibre draw.getAll()
method returns a FeatureCollection. We need to extract and merge the feature geometries into a single GeometryCollection, which is now simplified and cleaned by the form validation script in the form class AreaModelForm
. It seems that this is the form required for successful conversion to a .wkt
which can be used in the geom__within
calculation in the model class Area
.