@osm-editor-kit/street-imagery 0.1.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +29 -0
- package/dist/config.d.ts +10 -0
- package/dist/data/geojson.d.ts +7 -0
- package/dist/filters/searchFilters.d.ts +19 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1815 -0
- package/dist/map/viewCone.d.ts +4 -0
- package/dist/map/viewfields.d.ts +24 -0
- package/dist/providers/adapters/kartaview.d.ts +18 -0
- package/dist/providers/adapters/lookaround.d.ts +17 -0
- package/dist/providers/adapters/mapilio.d.ts +7 -0
- package/dist/providers/adapters/mapillary-map-features.d.ts +4 -0
- package/dist/providers/adapters/mapillary-signs.d.ts +4 -0
- package/dist/providers/adapters/mapillary.d.ts +5 -0
- package/dist/providers/adapters/panoramax.d.ts +6 -0
- package/dist/providers/adapters/streetside.d.ts +16 -0
- package/dist/providers/adapters/streetview.d.ts +16 -0
- package/dist/providers/adapters/vegbilder.d.ts +14 -0
- package/dist/providers/fetchMvt.d.ts +5 -0
- package/dist/providers/mapillaryShared.d.ts +6 -0
- package/dist/providers/model.d.ts +67 -0
- package/dist/providers/registry.d.ts +29 -0
- package/dist/providers/tileCache.d.ts +9 -0
- package/dist/providers/tileMath.d.ts +16 -0
- package/dist/viewer/clickRadius.d.ts +4 -0
- package/dist/viewer/externalLinks.d.ts +5 -0
- package/dist/viewer/groupClickedPhotos.d.ts +20 -0
- package/dist/viewer/photoThumbnails.d.ts +17 -0
- package/dist/viewer/streetsidePreview.d.ts +8 -0
- package/package.json +56 -0
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# `@osm-editor-kit/street-imagery`
|
|
2
|
+
|
|
3
|
+
**Status:** First npm **alpha** (`0.1.0-alpha.0`). Publish with `bun run packages:release -- --publish-only` after `npm login`.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
Provider-agnostic street-level imagery core: ten adapters (Mapillary, Panoramax, KartaView, Mapilio, Bing Streetside, Vegbilder, Google Street View, Apple Look Around, plus Mapillary signs and map features), normalized photo/sequence/map-feature types, bbox and MVT tile fetching, GeoJSON builders, viewfield geometry, date/type filters, and viewer helpers (deep links, click-radius grouping, thumbnails).
|
|
8
|
+
|
|
9
|
+
For MapLibre React layers, use `@osm-editor-kit/street-imagery-react`.
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import {
|
|
15
|
+
adapterById,
|
|
16
|
+
createStreetImageryConfig,
|
|
17
|
+
photosToFeatureCollection,
|
|
18
|
+
setStreetImageryConfig,
|
|
19
|
+
} from '@osm-editor-kit/street-imagery'
|
|
20
|
+
|
|
21
|
+
setStreetImageryConfig(
|
|
22
|
+
createStreetImageryConfig({ mapillaryToken: '…' }),
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
const bbox = [13.44, 52.47, 13.45, 52.48] as const // west, south, east, north
|
|
26
|
+
const controller = new AbortController()
|
|
27
|
+
const photos = await adapterById.mapillary.fetchPhotos!(bbox, 16, controller.signal)
|
|
28
|
+
const geojson = photosToFeatureCollection(photos)
|
|
29
|
+
```
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type StreetImageryConfig = {
|
|
2
|
+
mapillaryToken: string;
|
|
3
|
+
panoramaxApiBase: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const createStreetImageryConfig: (input: {
|
|
6
|
+
mapillaryToken: string;
|
|
7
|
+
panoramaxApiBase?: string;
|
|
8
|
+
}) => StreetImageryConfig;
|
|
9
|
+
export declare const setStreetImageryConfig: (config: StreetImageryConfig) => void;
|
|
10
|
+
export declare const getStreetImageryConfig: () => StreetImageryConfig;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FeatureCollection, LineString, MultiLineString, Point } from 'geojson';
|
|
2
|
+
import type { NormalizedMapFeature, NormalizedPhoto, NormalizedSequence } from '../providers/model';
|
|
3
|
+
export declare const photosToFeatureCollection: (photos: NormalizedPhoto[]) => FeatureCollection<Point>;
|
|
4
|
+
export declare const mapFeaturesToFeatureCollection: (features: NormalizedMapFeature[]) => FeatureCollection<Point>;
|
|
5
|
+
export declare const sequencesToFeatureCollection: (sequences: NormalizedSequence[]) => FeatureCollection<LineString | MultiLineString>;
|
|
6
|
+
export declare const emptyPointCollection: () => FeatureCollection<Point>;
|
|
7
|
+
export declare const emptyLineCollection: () => FeatureCollection<LineString | MultiLineString>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpressionSpecification } from 'maplibre-gl';
|
|
2
|
+
import type { NormalizedMapFeature, NormalizedPhoto } from '../providers/model';
|
|
3
|
+
export type PhotoTypeFilter = 'flat' | 'pano';
|
|
4
|
+
export type DateRange = {
|
|
5
|
+
from?: string;
|
|
6
|
+
to?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const parseIsoDateStartMs: (isoDate: string) => number;
|
|
9
|
+
export declare const parseIsoDateEndMs: (isoDate: string) => number;
|
|
10
|
+
/** iD edge case: swap when from > to. */
|
|
11
|
+
export declare const normalizeDateRange: (date?: DateRange) => DateRange | undefined;
|
|
12
|
+
export declare const photoTypesFilter: (photoTypes?: PhotoTypeFilter[]) => PhotoTypeFilter[] | undefined;
|
|
13
|
+
export declare const photoMatchesPhotoTypes: (photo: NormalizedPhoto, photoTypes?: PhotoTypeFilter[]) => boolean;
|
|
14
|
+
export declare const photoMatchesDateRange: (photo: NormalizedPhoto, date?: DateRange) => boolean;
|
|
15
|
+
export declare const photoMatchesFilters: (photo: NormalizedPhoto, photoTypes?: PhotoTypeFilter[], date?: DateRange) => boolean;
|
|
16
|
+
/** Map features use iD date semantics: last_seen_at >= from; first_seen_at <= to. */
|
|
17
|
+
export declare const mapFeatureMatchesDateRange: (feature: NormalizedMapFeature, date?: DateRange) => boolean;
|
|
18
|
+
export declare const buildPhotoLayerFilter: (photoTypes?: PhotoTypeFilter[], date?: DateRange) => ExpressionSpecification;
|
|
19
|
+
export declare const buildMapFeatureLayerFilter: (date?: DateRange) => ExpressionSpecification;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { createStreetImageryConfig, getStreetImageryConfig, setStreetImageryConfig, type StreetImageryConfig, } from './config';
|
|
2
|
+
export * from './data/geojson';
|
|
3
|
+
export { buildMapFeatureLayerFilter, buildPhotoLayerFilter, mapFeatureMatchesDateRange, normalizeDateRange, parseIsoDateEndMs, parseIsoDateStartMs, photoMatchesDateRange, photoMatchesFilters, photoMatchesPhotoTypes, photoTypesFilter, type DateRange, type PhotoTypeFilter, } from './filters/searchFilters';
|
|
4
|
+
export { coneRadiusMeters, viewConeGeoJson } from './map/viewCone';
|
|
5
|
+
export { emptyPolygonCollection, FLAT_VIEWFIELD_FOV_DEG, flatViewfieldTriangle, PANO_VIEWFIELD_FOV_DEG, photosToViewfieldsFeatureCollection, type ViewfieldPhotoProps, } from './map/viewfields';
|
|
6
|
+
export * from './providers/model';
|
|
7
|
+
export * from './providers/registry';
|
|
8
|
+
export { fetchMapillaryMvtTiles, mapillaryTileUrl, pointLngLat } from './providers/mapillaryShared';
|
|
9
|
+
export * from './providers/fetchMvt';
|
|
10
|
+
export * from './providers/tileCache';
|
|
11
|
+
export * from './providers/tileMath';
|
|
12
|
+
export * from './viewer/clickRadius';
|
|
13
|
+
export * from './viewer/externalLinks';
|
|
14
|
+
export * from './viewer/groupClickedPhotos';
|
|
15
|
+
export * from './viewer/photoThumbnails';
|
|
16
|
+
export { buildStreetsidePreviewUrl } from './viewer/streetsidePreview';
|
|
17
|
+
export { lookAroundDeepLink } from './providers/adapters/lookaround';
|
|
18
|
+
export { fetchStreetViewMetadata, getGoogleMapsApiKey, type StreetViewMetadataResponse, } from './providers/adapters/streetview';
|