Skip to content

Commit 0e6e3e2

Browse files
committed
Improves map interactions and test data, closes #190
Enhances map interactions to handle overlapping geometries and highlights related shapes. Adds global coverage test data with points and lines for more diverse map scenarios.
1 parent e25cdec commit 0e6e3e2

File tree

8 files changed

+1920
-276
lines changed

8 files changed

+1920
-276
lines changed

.claude/settings.local.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"Bash(python manage.py shell:*)",
1616
"Bash(python manage.py:*)",
1717
"Bash(python -m py_compile:*)",
18-
"Bash(python:*)"
18+
"Bash(python:*)",
19+
"Bash(node --check:*)"
1920
],
2021
"deny": [],
2122
"ask": []

fixtures/create_global_feeds_fixture.py

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,38 @@
9999
("Global Climate Network", "MULTIPOLYGON (((-120 30, -100 30, -100 45, -120 45, -120 30)), ((10 40, 30 40, 30 55, 10 55, 10 40)), ((120 -30, 140 -30, 140 -20, 120 -20, 120 -30)), ((-50 -20, -40 -20, -40 -10, -50 -10, -50 -20)))", "North America, Europe, Australia, South America"),
100100
]
101101

102+
# Point geometries - one per global region (7 continents + 5 oceans = 12 points)
103+
REGION_POINTS = [
104+
# Continental points
105+
("Field Site: Central Africa", "POINT (20 0)", "field research station in central Africa"),
106+
("Field Site: Central Europe", "POINT (15 50)", "field research station in central Europe"),
107+
("Field Site: Central Asia", "POINT (85 45)", "field research station in central Asia"),
108+
("Field Site: Central North America", "POINT (-100 45)", "field research station in central North America"),
109+
("Field Site: Central South America", "POINT (-60 -15)", "field research station in central South America"),
110+
("Field Site: Central Australia", "POINT (135 -25)", "field research station in central Australia"),
111+
("Field Site: Antarctic Peninsula", "POINT (-60 -70)", "field research station in Antarctica"),
112+
# Ocean points
113+
("Monitoring Buoy: Central Atlantic", "POINT (-30 20)", "ocean monitoring buoy in the Atlantic Ocean"),
114+
("Monitoring Buoy: Central Pacific", "POINT (170 0)", "ocean monitoring buoy in the Pacific Ocean"),
115+
("Monitoring Buoy: Central Indian Ocean", "POINT (75 -20)", "ocean monitoring buoy in the Indian Ocean"),
116+
("Monitoring Buoy: Arctic Ocean", "POINT (0 85)", "ocean monitoring buoy in the Arctic Ocean"),
117+
("Monitoring Buoy: Southern Ocean", "POINT (100 -65)", "ocean monitoring buoy in the Southern Ocean"),
118+
]
119+
120+
# Line geometries - spanning at least two regions (10 lines)
121+
CROSS_REGION_LINES = [
122+
("Migration Route: Africa to Europe", "LINESTRING (20 -5, 25 10, 15 35, 10 45)", "bird migration corridor from Africa through Mediterranean to Europe"),
123+
("Migration Route: Asia to Australia", "LINESTRING (100 30, 110 10, 120 -10, 130 -20)", "bird migration corridor from Asia to Australia"),
124+
("Shipping Lane: Atlantic Crossing", "LINESTRING (-75 40, -50 45, -25 50, -5 52)", "major shipping route across North Atlantic from North America to Europe"),
125+
("Shipping Lane: Pacific Crossing", "LINESTRING (140 35, 170 38, -160 40, -130 42)", "major shipping route across North Pacific from Asia to North America"),
126+
("Ocean Current: Gulf Stream", "LINESTRING (-80 25, -70 30, -50 35, -30 40, -10 50)", "Gulf Stream current from Gulf of Mexico to North Atlantic"),
127+
("Ocean Current: Kuroshio", "LINESTRING (125 25, 135 30, 145 35, 155 40)", "Kuroshio Current along eastern Asia into Pacific"),
128+
("Seismic Survey: Mid-Atlantic Ridge", "LINESTRING (-35 -30, -30 -10, -25 10, -20 30, -15 50)", "geological survey along Mid-Atlantic Ridge from South Atlantic to North Atlantic"),
129+
("Seismic Survey: Ring of Fire West", "LINESTRING (120 -10, 125 0, 130 10, 135 20, 140 30)", "seismic monitoring along western Pacific Ring of Fire from Indian Ocean to Pacific"),
130+
("Cable Route: Trans-Pacific", "LINESTRING (-120 35, -140 32, -160 30, -180 28, 170 26, 150 25)", "undersea telecommunications cable across Pacific from North America to Asia"),
131+
("Cable Route: Europe-Africa", "LINESTRING (10 55, 5 45, 0 35, -5 25, 0 10, 5 0)", "undersea cable from Europe through Atlantic to Africa"),
132+
]
133+
102134
def create_source(pk, name, issn_l=None, is_oa=True):
103135
"""Create a source object."""
104136
return {
@@ -172,7 +204,7 @@ def create_publication(pk, source_pk, title, abstract, geometry_wkt, region_desc
172204
"model": "publications.publication",
173205
"pk": pk,
174206
"fields": {
175-
"status": random.choice(["p", "p", "p", "h", "c"]), # mostly published
207+
"status": "p", # all published for UI testing
176208
"title": title,
177209
"abstract": abstract,
178210
"publicationDate": pub_date.strftime("%Y-%m-%d"),
@@ -320,6 +352,56 @@ def main():
320352
keyword_idx += 1
321353
topic_idx += 1
322354

355+
print("\n=== Creating point-based field sites and monitoring stations ===")
356+
for i, (title, geometry, description) in enumerate(REGION_POINTS):
357+
pk = pk_counter
358+
pk_counter += 1
359+
source_pk_choice = 2000 + (i % len(sources))
360+
361+
pub = create_publication(
362+
pk=pk,
363+
source_pk=source_pk_choice,
364+
title=title,
365+
abstract=f"Point-based monitoring and research from {description}. This site provides continuous data collection and analysis for local environmental conditions.",
366+
geometry_wkt=geometry,
367+
region_desc=description,
368+
authors_idx=author_idx,
369+
keywords_idx=keyword_idx,
370+
topics_idx=topic_idx,
371+
has_openalex=True,
372+
)
373+
fixture_data.append(pub)
374+
print(f" [{pk}] {title}: {len(pub['fields']['authors'])} authors, {len(pub['fields']['keywords'])} keywords, {len(pub['fields']['topics'])} topics")
375+
376+
author_idx += 1
377+
keyword_idx += 1
378+
topic_idx += 1
379+
380+
print("\n=== Creating cross-region line features (routes, currents, surveys) ===")
381+
for i, (title, geometry, description) in enumerate(CROSS_REGION_LINES):
382+
pk = pk_counter
383+
pk_counter += 1
384+
source_pk_choice = 2000 + (i % len(sources))
385+
386+
pub = create_publication(
387+
pk=pk,
388+
source_pk=source_pk_choice,
389+
title=title,
390+
abstract=f"Linear pathway study documenting {description}. This research traces continuous phenomena across regional boundaries.",
391+
geometry_wkt=geometry,
392+
region_desc=description,
393+
authors_idx=author_idx,
394+
keywords_idx=keyword_idx,
395+
topics_idx=topic_idx,
396+
has_openalex=True,
397+
)
398+
fixture_data.append(pub)
399+
print(f" [{pk}] {title}: {len(pub['fields']['authors'])} authors, {len(pub['fields']['keywords'])} keywords, {len(pub['fields']['topics'])} topics")
400+
401+
author_idx += 1
402+
keyword_idx += 1
403+
topic_idx += 1
404+
323405
# Create backup of original
324406
import os
325407
import shutil
@@ -346,10 +428,12 @@ def main():
346428

347429
print("\n=== Summary ===")
348430
print(f"Total publications: {len(publications)}")
349-
print(f" - Continents: {len(CONTINENTS)}")
350-
print(f" - Oceans: {len(OCEANS)}")
351-
print(f" - Two-region overlaps: {len(TWO_REGION_OVERLAPS)}")
352-
print(f" - Multi-region spans: {len(MULTI_REGION_SPANS)}")
431+
print(f" - Continents (polygons): {len(CONTINENTS)}")
432+
print(f" - Oceans (polygons): {len(OCEANS)}")
433+
print(f" - Two-region overlaps (polygons): {len(TWO_REGION_OVERLAPS)}")
434+
print(f" - Multi-region spans (polygons): {len(MULTI_REGION_SPANS)}")
435+
print(f" - Region points (points): {len(REGION_POINTS)}")
436+
print(f" - Cross-region lines (linestrings): {len(CROSS_REGION_LINES)}")
353437
print(f"\nMetadata coverage:")
354438
print(f" - With authors: {with_authors}/{len(publications)}")
355439
print(f" - With keywords: {with_keywords}/{len(publications)}")

0 commit comments

Comments
 (0)