@sv-tools/service
v0.1.0
Published
Extended StreetViewService implementation
Downloads
1
Readme
@sv-tools/service
An extended google.maps.StreetViewService
with support for bulk panorama metadata requests.
import {
StreetViewService,
StreetViewSource,
type PanoramaData,
} from '@sv-tools/service'
new StreetViewService(options?)
Create a StreetViewService
instance. Optionally provide:
options.cache?: Map<string, Promise<PanoramaData | null>>
- a cache implementation for panorama metadata requests. quick-lru is a nice option.
sv.getPanorama(options: google.maps.StreetViewPanoRequest): Promise<{ data: PanoramaData }>
Find a panorama by ID and return metadata. Throws an error if the panorama does not exist.
This function performs automatic batching.
sv.getPanorama(options: google.maps.StreetViewLocationRequest): Promise<{ data: PanoramaData }>
Find a panorama based on some search criteria and return metadata. Throws an error if there are no results.
This function is not cached and does not do any batching. Each call corresponds to an HTTP request.
PanoramaData
The panorama data returned by this package includes a bit more data than normal. The additions are:
interface PanoramaData extends google.maps.StreetViewPanoramaData {
location: {
profileUrl?: string | null,
}
time: {
pano: string,
date: Date,
}[]
tiles: {
originHeading?: number,
originPitch?: number,
}
extra?: {
panoType: ImageFrontendType,
countryCode: string | null,
uploaderName: string | null,
}
}
License
MIT · ⓒ 2023 Renée Kooi