mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
Coverage lines from KartaView's z13-14 JSON tiles (OSM ways with photos, chained end to start), the photo nearest a clicked line, cones along its sequence, and a viewer for flat photos and 360° panoramas (a small WebGL equirectangular renderer, no new dependency) with ‹ › along the sequence. Mapillary's camera-driven line coverage and sequence cones move to the provider-neutral core (lineCoverage.js, sequenceCones.js) with the tile fetch, zoom ladder, colours and pick prefixes injected; Mapillary keeps thin wrappers and its tests pass unchanged. KartaView quirks handled: api.kartaview.org (the documented api.openstreetcam.org serves empty tiles), photo URLs that name storage1 for photos stored elsewhere, and a photo API that answers 429 to more than about three requests at once (two in flight, retried with backoff). Co-Authored-By: Claude Opus 5.5 <[email protected]>
51 lines
1.7 KiB
JavaScript
51 lines
1.7 KiB
JavaScript
import { createStreetLevelLayer } from '../../layers/streetLevel/index.js';
|
|
import { createMapillaryProvider } from '../../layers/streetLevel/providers/mapillary/index.js';
|
|
import { createGoogleProvider } from '../../layers/streetLevel/providers/google/index.js';
|
|
import { createKartaViewProvider } from '../../layers/streetLevel/providers/kartaview/index.js';
|
|
import * as sprites from '../../data/spriteOrder.js';
|
|
import * as picking from '../../data/pickRegistry.js';
|
|
import * as input from '../../data/inputOwnership.js';
|
|
import * as scenePick from '../../data/scenePick.js';
|
|
import * as render from '../../renderGovernor.js';
|
|
|
|
/** The browser Maps key the scene was started with (src/app/scene.js). */
|
|
const googleApiKey = () => globalThis.window?.__GOOGLE_MAPS_API_KEY__ || null;
|
|
|
|
/**
|
|
* Mapillary, Google Street View and KartaView, once the Mapillary source is
|
|
* supplied; else none.
|
|
*/
|
|
function defaultProviders(sources) {
|
|
if (sources.mapillary == null) return [];
|
|
return [
|
|
createMapillaryProvider({ source: sources.mapillary }),
|
|
createGoogleProvider({ getApiKey: googleApiKey }),
|
|
createKartaViewProvider(),
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Inject providers, or use the defaults. An explicit provider list replaces
|
|
* them; an unused sources.mapillary is neither constructed nor validated,
|
|
* including when the list is empty.
|
|
*/
|
|
export function createApplicationStreetLevel({
|
|
surface,
|
|
sources = {},
|
|
providers = defaultProviders(sources),
|
|
}) {
|
|
return createStreetLevelLayer({
|
|
providers,
|
|
services: {
|
|
sprites,
|
|
picking,
|
|
input,
|
|
scenePick,
|
|
render,
|
|
ground: surface?.groundFloor ?? null,
|
|
meshFloor: surface?.meshFloor ?? null,
|
|
terrain: surface?.terrain ?? null,
|
|
},
|
|
});
|
|
}
|