rdview-service
Version:
Rdview service for loading road photos
63 lines (44 loc) • 1.55 kB
Markdown
Service for [rdview](https://i.centr.by/rdview) to receive photos from roads.
Serivice uses rdview api and provides photos from roads of Belarus. Required [authorization](https://i.centr.by/oauth/)
Photo types - 2D and 3D equirectangular panoramas.
[](https://github.com/beldorcentr/rdview-front)
```
npm install rdview-service
```
```
// js
import { RdviewService } from 'rdview-service';
// ts
import {
RdviewService, Passage, View, Road, Segment, CurrentPosition
} from 'rdview-service';
const rdviewService = new RdviewService({
// default: apiUrl: 'https://i.centr.by/rdview/api',
authorization: 'Bearer YOUR_OAUTH_TOKEN'
});
rdviewService.initByCoordinates(52.34, 28.9)
.then(currentPosition => handleNewPosition(currentPosition));
// moving
rdviewService.getNextView()
.then(currentPosition => handleNewPosition(currentPosition));
// change passage
rdviewService.setPassage(passageId)
.then(currentPosition => handleNewPosition(currentPosition));
function handleNewPosition(position) {
// position.road.name
// position.currentView.km
// position.currentView.lat
// position.currentView.lon
// position.currentView.azimuth
// position.currentView.date
// position.currentView.imgUrl
// position.currentView.viewType
// position.passages[0].id
}
```
viewType: 'twoDimensional' or 'equirectangularPanorama'
Full documentation in [DOCUMENTATION.md](DOCUMENTATION.md)