diff --git a/application/core/filters.py b/application/core/filters.py index a415956d..444c0fe4 100644 --- a/application/core/filters.py +++ b/application/core/filters.py @@ -169,7 +169,11 @@ def digital_land_to_json(dict): filtered_dict = dict.get("row", {}) is_truncated = dict.get("is_truncated", False) if is_truncated: - filtered_dict = {k: v for k, v in filtered_dict.items() if k != "geometry"} + # Replace geometry with a placeholder message if truncated + if "geometry" in filtered_dict: + filtered_dict[ + "geometry" + ] = "Too large to display. Download JSON for full geometry." # dict["geometry"] = dict["geometry"][:1000] return json.dumps( filtered_dict, default=str, indent=4, cls=NoneToEmptyStringEncoder @@ -262,7 +266,7 @@ def make_link_filter(eval_ctx, url, **kwargs): def get_entity_geometry(entity): data = None if entity and entity.geojson is not None: - data = entity.geojson.geometry + data = entity.geojson if data is None: logger.warning( diff --git a/application/templates/entity.html b/application/templates/entity.html index 2f43900f..d842d0bf 100644 --- a/application/templates/entity.html +++ b/application/templates/entity.html @@ -10,9 +10,9 @@ {% set is_truncated = false %} {% if row['geometry'] %} - {% if row['geometry']|length > 10000 %} + {% if row['geometry']|length > 1000000 %} {% set is_truncated = true %} - {% set truncated_geometry = row['geometry'][:10000] %} + {% set truncated_geometry = row['geometry'][:1000000] %} {% else %} {% set truncated_geometry = row['geometry'] %} {% endif %} @@ -98,7 +98,7 @@
{% if row[field] is not none %}
- {{ truncated_geometry }}{% if row[field]|length > 10000 %}... Load More{% endif %}
+ {{ truncated_geometry }}{% if row[field]|length > 1000000 %}... Load More{% endif %}
{% endif %}