Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ohmg/api/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MapListSchema2(Schema):
sheet_ct: int
volume_number: Optional[str]
gt_exists: bool
xyz_tiles_exists: bool
featured: bool
hidden: bool
document_ct: int
Expand Down Expand Up @@ -485,6 +486,7 @@ class LayerSetSchema(Schema):
extent: Optional[tuple]
multimask_extent: Optional[tuple]
mosaic_cog_url: Optional[str]
xyz_tiles_url: Optional[str]

@staticmethod
def resolve_id(obj):
Expand Down
8 changes: 8 additions & 0 deletions ohmg/core/models/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,14 @@ def gt_exists(self):
else False
)

@property
def xyz_tiles_exists(self):
return (
True
if self.get_layerset("main-content") and self.get_layerset("main-content").xyz_tiles_url
else False
)

@property
def mj_exists(self):
return (
Expand Down
2 changes: 2 additions & 0 deletions ohmg/core/utils/s3.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from django.conf import settings

def get_boto3_s3_client():
import boto3

Expand Down
15 changes: 14 additions & 1 deletion ohmg/extensions/views.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import json

import topojson
from django.http import JsonResponse
from django.views import View

from ohmg.conf.http import JsonResponseNotFound
from ohmg.core.models import Map
from ohmg.core.utils import full_reverse

Expand Down Expand Up @@ -62,7 +66,16 @@ def get(self, request, place, operation):
"name": f"{place.slug}-volume-extents",
"features": features,
}
return JsonResponse(feature_collection)
topo = topojson.Topology(feature_collection)
topo_json = json.loads(topo.to_json())

## extra key needed for atlascope detroit
if place.slug == "detroit-mi":
topo_json["objects"]["detroit-volume-extents"] = topo_json["objects"]["data"]
return JsonResponse(topo_json)

elif operation == "coverages":
return JsonResponse([{"name": str(place), "center": place.get_center()}], safe=False)

else:
return JsonResponseNotFound("invalid operation. must be 'footprints' or 'coverages'")
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@
n/a
{/if}
</dd>
{#if ls.xyz_tiles_url}
<dt>XYZ tileset</dt>
<dd>
<pre style="margin:0;">{`${ls.xyz_tiles_url}/{z}/{x}/{y}.png`}</pre>
</dd>
{/if}
<dt>IIIF Georef AnnotationPage (JSON)</dt>
<dd>
<Link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,8 @@
bind:offset
/></th
>
<th><SortableHeader title="GT" alt="A geotiff has been created for this map's main content" /></th>
<th class="new-col"><SortableHeader title="GT" alt="A geotiff has been created for this map's main content" /></th>
<th><SortableHeader title="XYZ" alt="An XYZ tileset has been created for this map's main content" /></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -257,6 +258,13 @@
<span style="color:red">x</span>
{/if}</td
>
<td class="number-col"
>{#if s.xyz_tiles_exists}
<span style="color:green">✓</span>
{:else}
<span style="color:red">x</span>
{/if}</td
>
</tr>
{/each}
</tbody>
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ dependencies = [
# for celery beat
"pytz",
"rio-tiler>=5.0.3",
"topojson>=1.10",
]

[project.optional-dependencies]
Expand Down
35 changes: 35 additions & 0 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.