Reverse Geocode
Reverse Geocoding
Convert coordinates to human-readable addresses with administrative details (district, division, thana) in English and Bangla. Use for displaying user location, delivery addresses, and location tagging.
danger
Enabling all optional parameters triggers multiple API calls, consuming more credits. Request only essential parameters.
Usage
import { createBarikoiClient } from "barikoiapis";
const barikoi = createBarikoiClient({
apiKey: "YOUR_BARIKOI_API_KEY",
});
const result = await barikoi.reverseGeocode({
latitude: 23.8103,
longitude: 90.4125,
district: true,
bangla: true,
});
const place = result.data?.place;
Response
This API initially returns:
id, distance_within_meters, address, area, city, postCode
Optional Parameters
You can customize the reverse geocoding request by including additional optional parameters:
| Parameter | Type | Description |
|---|---|---|
latitude | number | Required. Latitude coordinate |
longitude | number | Required. Longitude coordinate |
district | boolean | Include district in response |
division | boolean | Include division in response |
thana | boolean | Include thana in response |
sub_district | boolean | Include sub-district in response |
union | boolean | Include union in response |
pauroshova | boolean | Include pauroshova in response |
country | boolean | Include country in response |
bangla | boolean | Include Bangla translations |
address | boolean | Include address details |
area | boolean | Include area details |
post_code | boolean | Include postal code |
location_type | boolean | Include location type |
Example with District
const result = await barikoi.reverseGeocode({
latitude: 23.810331,
longitude: 90.412521,
district: true,
});
const place = result.data?.place;
console.log(place?.district);
Type Definitions
export type ReverseGeocodeParams = {
longitude: number;
latitude: number;
country_code?: string;
country?: boolean;
district?: boolean;
post_code?: boolean;
sub_district?: boolean;
union?: boolean;
pauroshova?: boolean;
location_type?: boolean;
division?: boolean;
address?: boolean;
area?: boolean;
bangla?: boolean;
thana?: boolean;
};
export type ReverseGeocodeSuccess = {
place?: {
id?: string | number;
distance_within_meters?: number;
address?: string;
area?: string;
city?: string;
postCode?: string;
address_bn?: string;
area_bn?: string;
city_bn?: string;
country?: string;
division?: string;
district?: string;
sub_district?: string;
pauroshova?: string | null;
union?: string | null;
location_type?: string;
address_components?: {
place_name?: string | null;
house?: string | null;
road?: string | null;
} | null;
area_components?: {
area?: string | null;
sub_area?: string | null;
} | null;
thana?: string;
thana_bn?: string;
};
status?: number;
};