0.5.7 • Published 1 year ago
mapir-api v0.5.7
Installation
With npm:
npm install --save mapir-api
With Yarn:
yarn add mapir-api
With pnpm:
pnpm add mapir-api
Usage
Import MapirApi:
import { MapirApi } from 'mapir-api';
Create an instance using apiKey:
const mapirApi = new MapirApi({ apiKey: MAPIR_API_KEY, })
Examples
Reverse and FastReverse
Both of them use to convert geographical coordinates to address details. the only difference is in response time. * *FastReverse is about 20ms and Reverse** api is around 70ms.
const reverseResponse = await mapirApi.fastReverse({
latitude: 35.72379,
longitude: 51.33417,
});
const reverseResponse = await mapirApi.reverse({
latitude: 35.72379,
longitude: 51.33417,
});
Search and AutoCompleteSearch
We use them in order to find places based on your desired text. The differences of them is only related to search algorithm. Such that search api find places exactly equal to the text but autocomplete api search location matches part of the entered information with existing data and suggests the closest and most likely results.
const searchResponseList = await mapirApi.search(
new SearchRequest({ text: 'صادقیه' }),
);
const autoCompleteSearchResponseList = await mapirApi.autoCompleteSearch(
new SearchRequest({ text: 'صادقیه' }),
);