mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
Recent community wildlife observations, as a new Wildlife group in the layer panel. - Server: keyless iNaturalist proxy (v2 observations with only the projected fields; undocumented v1 UTFGrid density tiles, decoded on the server) sharing one paced queue (burst 4, ~1/s, 60/min, 8,000/day budget, up to four in flight), in-memory caches and upstream-only cooldowns; Acartia Salish Sea marine-mammal feed rounded to 0.01 degrees with comments dropped. - Layer: grid counts drawn as a soft view-ranked density glow; real sampled sightings as taxon badges at their true positions with ambient photo thumbnails and labels; obscured records stay privacy cells; a clicked sighting stays pinned through camera moves and refreshes. - Anchored photo card per selection with the single iNaturalist link; attribution in the layer row and the Data attribution popover. - Filters (CONFIRMED, taxa presets) round-trip in share links with token 9. Co-Authored-By: Claude Opus 5.5 <[email protected]>
52 lines
1.5 KiB
JavaScript
52 lines
1.5 KiB
JavaScript
/** Build a synthetic UTFGrid with logical cell counts and repeated hit pixels. */
|
|
export function syntheticGrid({
|
|
z = 2,
|
|
x = 1,
|
|
y = 1,
|
|
cells = [
|
|
{ row: 1, column: 51, count: 6, iconic: 3 },
|
|
{ row: 3, column: 49, count: 12, iconic: 47170 },
|
|
],
|
|
} = {}) {
|
|
const pixels = Array.from({ length: 64 }, () => Array(64).fill(' '));
|
|
const keys = [''];
|
|
const data = {};
|
|
cells.forEach((cell, index) => {
|
|
const key = String(900_000_000 + index);
|
|
keys.push(key);
|
|
const value = index + 1;
|
|
let code = value + 32;
|
|
if (code >= 34) code += 1;
|
|
if (code >= 92) code += 1;
|
|
const character = String.fromCharCode(code);
|
|
for (const [row, column] of [
|
|
[cell.row, cell.column],
|
|
[cell.row - 1, cell.column],
|
|
[cell.row + 1, cell.column],
|
|
[cell.row, cell.column - 1],
|
|
[cell.row, cell.column + 1],
|
|
]) {
|
|
if (row >= 0 && row < 64 && column >= 0 && column < 64)
|
|
pixels[row][column] = character;
|
|
}
|
|
data[key] = {
|
|
captive: null,
|
|
cellCount: cell.count,
|
|
geoprivacy: null,
|
|
id: Number(key),
|
|
latitude:
|
|
(Math.atan(
|
|
Math.sinh(Math.PI * (1 - 2 * ((y + cell.row / 64) / 2 ** z))),
|
|
) *
|
|
180) /
|
|
Math.PI,
|
|
longitude: ((x + cell.column / 64) / 2 ** z) * 360 - 180,
|
|
private_location: null,
|
|
quality_grade: 'needs_id',
|
|
'taxon.iconic_taxon_id': cell.iconic,
|
|
uuid: `00000000-0000-4000-8000-${String(index).padStart(12, '0')}`,
|
|
};
|
|
});
|
|
return { grid: pixels.map((row) => row.join('')), keys, data };
|
|
}
|