make list of sites and stub out tile request function

This commit is contained in:
2026-01-21 23:22:47 +01:00
parent e82b3421c0
commit 08fe8ebc7f

View File

@@ -91,6 +91,7 @@
</div>
<button @click="dropPin" class="context-menu-item">📍 Drop Pin</button>
<button @click="startMeasure" class="context-menu-item">📏 Measure from here</button>
<button v-if="!contextMenu.hasTile" @click="requestTile" class="context-menu-item">📥 Request Tile</button>
</div>
<div
@@ -153,19 +154,98 @@ const nextPinNumber = ref(1);
const nextFeatureId = ref(1);
// UI state
const contextMenu = ref({ visible: false, x: 0, y: 0, lngLat: null });
const contextMenu = ref({ visible: false, x: 0, y: 0, lngLat: null, hasTile: false });
const popup = ref({ visible: false, x: 0, y: 0, type: null, feature: null });
// Map instance
let map = null;
let drawingHandler = null;
const KNOWN_SITES = [
{
"name":"Newark Octagon Earthworks",
"coordinates":[[-82.4463745,40.0519828]],
"description":"Part of the Newark Earthworks complex, the Octagon is precisely aligned to the 18.6-year lunar cycle. Connected to a 50-acre circle, this geometric earthwork demonstrates sophisticated astronomical knowledge. The Octagon's eight walls and Observatory Circle form one of only two known circle-octagon pairs in the Hopewell world.",
"type":"earthwork",
"tiles":[
'BS19820747',
'BS19820748',
'BS19830747',
'BS19830748',
'BS19820746',
'BS19810747',
'BS19810746'
],
"overlay": [
{
"type": 'polygon',
"coordinates": [
[-82.44123, 40.05443],
[-82.44260, 40.05309],
[-82.44464, 40.05237],
[-82.44631, 40.05342],
[-82.44728, 40.05500],
[-82.44589, 40.05633],
[-82.44389, 40.05698],
[-82.44216, 40.05595],
[-82.44123, 40.05443]
]
}
]
},
{
"name":"Great Circle Earthworks",
"coordinates":[[-82.4277555,40.0402671]],
"description":"A nearly perfect circle 1,200 feet in diameter, enclosing 30 acres. The earthen wall is lined by a deep interior ditch. Located in Heath, Ohio, this is one of the largest circular earthworks in the Americas and serves as the site of the Newark Earthworks Museum.",
"type":"earthwork",
"tiles":["BS19870742"]},
{
"name":"Van Voorhis Walls",
"coordinates":[[-82.446375,40.051983],[-82.447,40.048],[-82.448,40.045],[-82.45,40.04]],
"description":"The best-preserved section of the Great Hopewell Road, extending 2.5 miles south from the Newark Octagon to Ramp Creek. This confirmed earthwork consists of parallel walls approximately 50 meters (150-200 feet) apart, aligned on an azimuth of 211°. Still visible above ground in woodland areas too swampy to farm.",
"type":"road_confirmed",
"tiles":["BS19820746","BS19820745","BS19820743","BS19820742"]},
{
"name":"Mound City Group",
"coordinates":[[-83.0065767,39.3744923]],
"description":"The headquarters of Hopewell Culture National Historical Park. Contains 23 burial mounds within a nearly square earthen enclosure along the Scioto River. Each mound covered a charnel house where the dead were cremated. Excavations revealed spectacular artifacts including effigy pipes, mica, and copper.",
"type":"earthwork",
"tiles":["BS18250500"]},
{
"name":"Hopeton Earthworks",
"coordinates":[[-82.9809185,39.3790743]],
"description":"A geometric earthwork complex featuring a circle (320m diameter) and square of similar size, connected by parallel earthen lines aligned to the winter solstice. Located on a high terrace on the east side of the Scioto River, northeast from Mound City.",
"type":"earthwork",
"tiles":["BS18320502"]},
{
"name":"Hopewell Mound Group",
"coordinates":[[-83.0844809,39.3608166]],
"description":"The type site for the Hopewell culture, named after former landowner M. Cloud Hopewell. Contains 29 mounds including the largest known Hopewell mound—500 feet long and consisting of three conjoined circles. A semicircular earthwork encloses the main mound and four additional mounds.",
"type":"earthwork",
"tiles":["BS18020495"]},
{
"name":"Seip Earthworks",
"coordinates":[[-83.2214086,39.2416867]],
"description":"One of the largest Hopewell complexes, featuring two circles and a square enclosing 121 acres. The Seip-Pricer Mound stands 30 feet high. The square measures exactly 27 acres, matching four other nearby Hopewell sites, suggesting a common unit of measurement. Contains evidence of elaborate burials and exotic trade goods.",
"type":"earthwork",
"tiles":["BS17630452"]},
{
"name":"High Bank Works",
"coordinates":[[-82.94,39.26]],
"description":"Features a circle-octagon pair identical to the Newark Earthworks—both circles are exactly 1,050 feet in diameter. Located 60 miles from Newark on a terrace 75-80 feet above the Scioto River. The octagon is precisely aligned to the northernmost moonrise of the 18.6-year lunar cycle. Currently a research preserve, not open to the public.",
"type":"earthwork",
"tiles":["BS18430458"]}
];
// Tile names to load
const TILE_NAMES = [
'BS19820747',
'BS19820748',
'BS19830747',
'BS19830748'
'BS19830748',
'BS19820746',
'BS19810747',
'BS19810746',
];
// Newark Octagon coordinates
@@ -178,7 +258,7 @@ const octagonCoords = [
[-82.44589, 40.05633],
[-82.44389, 40.05698],
[-82.44216, 40.05595],
[-82.44123, 40.05443], // Close the polygon
[-82.44123, 40.05443],
];
const octagonCenter = [-82.44383, 40.05469];
@@ -221,6 +301,38 @@ function calculateBearing(lng1, lat1, lng2, lat2) {
return (θ * 180 / Math.PI + 360) % 360; // Bearing in degrees
}
// Check if a point has a loaded lidar tile
function hasLidarAtPoint(lng, lat) {
if (!map) return false;
// Check all loaded tile layers
for (const tileName of TILE_NAMES) {
const layerId = `tile-layer-${tileName}`;
if (!map.getLayer(layerId)) continue;
const source = map.getSource(`tile-${tileName}`);
if (!source) continue;
// Get the bounds from the image source coordinates
// coordinates are: [[topLeft], [topRight], [bottomRight], [bottomLeft]]
const coords = source.coordinates;
if (!coords || coords.length !== 4) continue;
const [topLeft, topRight, bottomRight, bottomLeft] = coords;
const minLng = Math.min(topLeft[0], bottomLeft[0]);
const maxLng = Math.max(topRight[0], bottomRight[0]);
const minLat = Math.min(bottomLeft[1], bottomRight[1]);
const maxLat = Math.max(topLeft[1], topRight[1]);
// Check if point is within bounds
if (lng >= minLng && lng <= maxLng && lat >= minLat && lat <= maxLat) {
return true;
}
}
return false;
}
// Extend a line from point1 through point2 to map bounds
function extendRay(lng1, lat1, lng2, lat2, bounds) {
const bearing = calculateBearing(lng1, lat1, lng2, lat2);
@@ -595,6 +707,33 @@ function clearAllGeometry() {
}
}
// Request a tile for a specific location
async function requestTile() {
const { lng, lat } = contextMenu.value.lngLat;
// TODO: Call backend endpoint
// For now, just log what we would send
const requestData = {
longitude: lng,
latitude: lat,
// Backend will:
// 1. Transform to Ohio State Plane South (EPSG:3735) in US Survey Feet
// 2. Call https://maps.ohio.gov/arcgis/rest/services/OGRIP/3DepTiles/MapServer/0/query
// 3. Extract TileName, County, Block
// 4. Return tile info and download URL
};
console.log('=== Tile Request ===');
console.log('Would send to backend:', requestData);
console.log('Backend endpoint: POST /api/tiles/request');
// Close the context menu
contextMenu.value.visible = false;
// TODO: Show loading indicator
// TODO: Handle response and update UI
}
function updateGeometryLayer() {
if (!map || !map.getSource('geometry')) return;
@@ -665,11 +804,13 @@ onMounted(() => {
// Context menu handler
map.on('contextmenu', (e) => {
e.preventDefault();
const hasTile = hasLidarAtPoint(e.lngLat.lng, e.lngLat.lat);
contextMenu.value = {
visible: true,
x: e.point.x,
y: e.point.y,
lngLat: e.lngLat
lngLat: e.lngLat,
hasTile: hasTile
};
});