npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

mapnests-react-native-sdk

v1.0.7

Published

React Native TypeScript SDK for Mapnests API integration (Distance Matrix, Distance Matrix Details, Geocode, Reverse Geocode) - React Native Only

Readme

Readme Top

A secure and efficient React Native TypeScript SDK for the Mapnests Platform, enabling powerful geospatial capabilities such as Search (Geocoding), Reverse (Reverse Geocoding), and Distance Matrix. Fully compatible with React Native and Node.js 22+.


📚 Table of Contents


Installation

npm install mapnests-react-native-sdk

Import into your React Native project:

import { Client, Mode } from "mapnests-react-native-sdk";

Requirements

  • React Native >= 0.60.0
  • Node.js >= 22.0.0

Quick Start

import { Client, Mode } from "mapnests-react-native-sdk";

(async function () {
  const client = new Client("YOUR_API_KEY", "your.package.name");

  const result = await client.search({ Query: "Dhaka" });
  console.log("Search result:", result);
})();

Core Features

Distance Matrix

Calculates the distance and estimated time of arrival (ETA) between origin and destination points.

Example Input:

const res = await client.distanceMatrix({
  OriginLat: 23.8103,
  OriginLon: 90.4125,
  DestLat: 23.75,
  DestLon: 90.42,
  Mode: Mode.Walking,
});
console.log(res);

Example Output:

{
  "data": {
    "distanceInMetres": 8900,
    "etaInSeconds": 1300
  }
}

Pairwise Route Summary

Computes distances, ETAs and geometries for multiple source-destination pairs in a single request. This is ideal for optimizing batch operations and comparing route statistics efficiently.

Example Input:

const summary = await client.pairwiseRouteSummary({
  pairs: [
    {
      id: 1,
      src: { lat: 23.8103, lon: 90.4125 },
      dest: { lat: 23.75, lon: 90.42 },
      mode: Mode.Walking,
    },
    {
      id: 2,
      src: { lat: 23.7806, lon: 90.3984 },
      dest: { lat: 23.774, lon: 90.3681 },
      mode: Mode.Car,
    },
  ],
});
console.log(summary);

Example Output:

{
  "status": true,
  "message": "success",
  "data": [
    {
      "id": 1,
      "distanceInMeters": 8900,
      "etaInSeconds": 1300,
      "geometry": "encoded_polyline_string"
    },
    {
      "id": 2,
      "distanceInMeters": 4800,
      "etaInSeconds": 700,
      "geometry": "another_encoded_polyline"
    }
  ]
}

Multi Source Route Summary

Computes distances, ETAs and geometries for multiple source-destination pairs in a single request. This is ideal for optimizing batch operations and comparing route statistics efficiently.

Example Input:

const summary = await client.multiSourceRouteSummary({
  sources: [
    {
      id: 1,
      lat: 23.7805733,
      lon: 90.2792399,
      mode: "car",
    },
    {
      id: 2,
      lat: 23.75,
      lon: 90.36,
      mode: "car",
    },
    {
      id: 3,
      lat: 23.7,
      lon: 90.42,
      mode: "car",
    },
    {
      id: 4,
      lat: 23.7654321,
      lon: 90.3456789,
      mode: "car",
    },
    {
      id: 5,
      lat: 23.7123456,
      lon: 90.3765432,
      mode: "car",
    },
  ],
  destination: {
    lat: 23.810332,
    lon: 90.412518,
  },
});

Example Output:

{
  "data": {
    "routeSummaries": [
      {
        "id": 1,
        "distanceInMeters": 23782.9,
        "etaInSeconds": 1720,
        "geometry": "encoded_polyline_string"
      },
      {
        "id": 2,
        "distanceInMeters": 13421.9,
        "etaInSeconds": 1084.9,
        "geometry": "encoded_polyline_string"
      },
      {
        "id": 3,
        "distanceInMeters": 15212.3,
        "etaInSeconds": 1285.3,
        "geometry": "encoded_polyline_string"
      },
      {
        "id": 4,
        "distanceInMeters": 14120.2,
        "etaInSeconds": 1129.3,
        "geometry": "encoded_polyline_string"
      },
      {
        "id": 5,
        "distanceInMeters": 16555.4,
        "etaInSeconds": 1388,
        "geometry": "encoded_polyline_string"
      }
    ]
  },
  "message": "Success",
  "status": true
}

Distance Matrix Details

Returns step-by-step routing metadata, including geometry, waypoints, and navigation instructions.

Example Input:

const details = await client.distanceMatrixDetails({
  OriginLat: 23.7806,
  OriginLon: 90.3984,
  DestLat: 23.774,
  DestLon: 90.3681,
  Mode: Mode.Car,
});
console.log(details);

Example Output (simplified):

{
  "status": true,
  "message": "success",
  "data": {
    "routeResponse": {
      "routes": [
        {
          "distance": 4800,
          "duration": 700,
          "geometry": "encoded_polyline",
          "legs": [ ... ]
        }
      ]
    }
  }
}

📘 For detailed documentation on all response fields (e.g., routes, legs, steps, maneuver, etc.), check the Distance Matrix Response Reference.

Search (Geocoding)

Finds places, streets, and landmarks by text query.

Example Input:

const searchRes = await client.search({
  Query: "Bashundhara Residential Area, Dhaka",
});
console.log(searchRes);

Example Output:

{
  "data": [
    {
      "place_id": "123456",
      "lat": "23.8156",
      "lon": "90.4287",
      "display_name": "Bashundhara Residential Area, Dhaka, Bangladesh"
    }
  ],
  "status": true,
  "message": "success"
}

Reverse Geocoding

Converts GPS coordinates into a readable address.

Example Input:

const revRes = await client.reverse({ Lat: 23.7806, Lon: 90.3984 });
console.log(revRes);

Example Output:

{
  "data": {
    "displayName": "Farmgate, Tejgaon, Dhaka, Bangladesh",
    "address": {
      "country": "Bangladesh",
      "state": "Dhaka Division",
      "city": "Dhaka"
    }
  },
  "status": true,
  "message": "success"
}

License

This project is licensed under the MIT License.


Contact

📧 [email protected] Explain