geo-reverse-turf
v1.0.12
Published
A TypeScript library for reverse geocoding GPS coordinates (latitude & longitude) to country and state information using a local GeoJSON file and Turf.js
Downloads
33
Readme
🌍 geo-reverse
A TypeScript library for reverse geocoding GPS coordinates (latitude & longitude) to country and state information using a local GeoJSON file and Turf.js — no external API required.
🔄 Batch reverse geocoding for multiple coordinates
🌍 Returns country name, country code, state name, and state code
📦 Optional country filtering using ISO Alpha-2 codes (e.g., "US", "IN")
⚡ Optimized for speed using local geospatial data (no external API calls)
📦 Installation
npm install geo-reverse-turfUsage
CommonJS
const { reverseGeocode } = require('geo-reverse-turf');
const result = reverseGeocode(latitude, longitude);
ES Module / TypeScript
import { reverseGeocode } from 'geo-reverse-turf';
const result = reverseGeocode(latitude, longitude);🌍 Batch lookup
Pass an array of coordinates to perform lookup in batch
const coordinates = [
[77.5946, 12.9716], // Bangalore, India
[-74.0060, 40.7128], // New York, USA
];
const results = reverseGeocodeBatch(coordinates);🌍 Filter by Country ISO Codes
To limit lookup to specific countries for performance, pass the country ISO codes as second parameter to reverseGeocodeBatch
const results = reverseGeocodeBatch(coordinates, ['IN', 'US']);