Skip to content

Commit

Permalink
increased the threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
ssadhu-sl committed Jan 10, 2025
1 parent f745cbb commit c9f7fba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions application/core/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
] = "<i>Too large to display. Download JSON for full geometry.</i>"
# dict["geometry"] = dict["geometry"][:1000]
return json.dumps(
filtered_dict, default=str, indent=4, cls=NoneToEmptyStringEncoder
Expand Down Expand Up @@ -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(
Expand Down
6 changes: 3 additions & 3 deletions application/templates/entity.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 %}
Expand Down Expand Up @@ -98,7 +98,7 @@ <h1 class="govuk-heading-xl">{{ row_name }}</h1>
{% if field == 'geometry' %}
<code class ="app-code-block" id="geometry-content">
{% if row[field] is not none %}
{{ truncated_geometry }}{% if row[field]|length > 10000 %}... <a href="javascript:void(0);" onclick="expandGeometry()">Load More</a>{% endif %}
{{ truncated_geometry }}{% if row[field]|length > 1000000 %}... <a href="javascript:void(0);" onclick="expandGeometry()">Load More</a>{% endif %}
{% endif %}
</code>
<code class ="app-code-block" id="geometry-full-content" style="display: none;">
Expand Down

0 comments on commit c9f7fba

Please sign in to comment.