Compare commits
6 Commits
e49eed21da
...
b5cf5c4446
| Author | SHA1 | Date | |
|---|---|---|---|
| b5cf5c4446 | |||
| 4c4d64cc3d | |||
| fbde03caec | |||
| 43eb598d3f | |||
| b7fac0ae03 | |||
| 447ba942b5 |
@ -53,7 +53,7 @@
|
|||||||
</td>
|
</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
{% if deduction.intervention.recorded %}
|
{% if deduction.intervention.recorded %}
|
||||||
<em title="{% trans 'Recorded on' %} {{obj.recorded.timestamp}} {% trans 'by' %} {{obj.recorded.user}}" class='fas fa-bookmark registered-bookmark'></em>
|
<em title="{% trans 'Recorded on' %} {{deduction.intervention.recorded.timestamp}} {% trans 'by' %} {{deduction.intervention.recorded.user}}" class='fas fa-bookmark registered-bookmark'></em>
|
||||||
{% else %}
|
{% else %}
|
||||||
<em title="{% trans 'Not recorded yet' %}" class='far fa-bookmark'></em>
|
<em title="{% trans 'Not recorded yet' %}" class='far fa-bookmark'></em>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ class SimpleGeomForm(BaseForm):
|
|||||||
geom = json.dumps(geojson)
|
geom = json.dumps(geojson)
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
# If no geometry exists for this form, we simply set the value to None and zoom to the maximum level
|
# If no geometry exists for this form, we simply set the value to None and zoom to the maximum level
|
||||||
geom = ""
|
geom = json.dumps({})
|
||||||
self.empty = True
|
self.empty = True
|
||||||
|
|
||||||
self.initialize_form_field("output", geom)
|
self.initialize_form_field("output", geom)
|
||||||
@ -72,20 +72,12 @@ class SimpleGeomForm(BaseForm):
|
|||||||
self.initialize_form_field("output", json.dumps(submitted_data))
|
self.initialize_form_field("output", json.dumps(submitted_data))
|
||||||
|
|
||||||
# Get geojson from form for validity checking
|
# Get geojson from form for validity checking
|
||||||
geom = self.data.get("output", None)
|
geom = self.data.get("output", json.dumps({}))
|
||||||
geom_is_empty = geom is None or len(geom) == 0
|
geom = json.loads(geom)
|
||||||
if geom_is_empty:
|
|
||||||
# If no geometry has been submitted, we create an empty geometry object since
|
|
||||||
# an empty geometry is a valid geometry
|
|
||||||
self.cleaned_data["output"] = MultiPolygon(srid=DEFAULT_SRID_RLP).ewkt
|
|
||||||
return is_valid
|
|
||||||
|
|
||||||
# Initialize features list with empty MultiPolygon, so that an empty input will result in a
|
# Initialize features list with empty MultiPolygon, so that an empty input will result in a
|
||||||
# proper empty MultiPolygon object
|
# proper empty MultiPolygon object
|
||||||
features = []
|
features = []
|
||||||
|
|
||||||
# Prepare geometry for validity checks (create iterable dict)
|
|
||||||
geom = json.loads(geom)
|
|
||||||
features_json = geom.get("features", [])
|
features_json = geom.get("features", [])
|
||||||
accepted_ogr_types = [
|
accepted_ogr_types = [
|
||||||
"Polygon",
|
"Polygon",
|
||||||
@ -141,6 +133,7 @@ class SimpleGeomForm(BaseForm):
|
|||||||
if features:
|
if features:
|
||||||
form_geom = MultiPolygon(*features, srid=DEFAULT_SRID_RLP).unary_union
|
form_geom = MultiPolygon(*features, srid=DEFAULT_SRID_RLP).unary_union
|
||||||
else:
|
else:
|
||||||
|
# If no features have been processed, this indicates an empty geometry - so we store an empty geometry
|
||||||
form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP)
|
form_geom = MultiPolygon(srid=DEFAULT_SRID_RLP)
|
||||||
|
|
||||||
# Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided.
|
# Make sure to convert into a MultiPolygon. Relevant if a single Polygon is provided.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user