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 🙏

© 2026 – Pkg Stats / Ryan Hefner

hamuga-imap-sdk

v0.0.2

Published

> **Note:** The Hamuga iMap JS SDK has a peer dependency on [maplibre-gl-js](https://github.com/maplibre/maplibre-gl-js).

Readme

Installation and Usage

With npm

Note: The Hamuga iMap JS SDK has a peer dependency on maplibre-gl-js.

Add the hamuga-imap-sdk and maplibre-gl packages

# with npm
npm install --save hamuga-imap-sdk maplibre-gl

Then import as an ES Module in your project

import HamugaImap from "hamuga-imap-sdk";
import "hamuga-imap-sdk/dist/hamuga-imap.min.css";

// === initialize with your API KEY key ===
HamugaImap.initialize({
  debug: true, // or false
  apiKey: "HAMUGA_IMAP_API_KEY",
  theme: "dark", // or 'light'
});

// === Create Map ===
mapRef.current = HamugaImap.ui.map({
  container: "map",
  center: [106.9, 47.9],
  zoom: 12,
  attributionControl: false,
});

// === Add Map Controls

// Get Maplibre
mlRef.current = HamugaImap.ui.maplibregl;

// scale ruler
mapRef.current.addControl(
  new mlRef.current.ScaleControl({ maxWidth: 120, unit: "metric" })
);

// custom attribution
mapRef.current.addControl(
  new mlRef.current.AttributionControl({
    compact: true,
    customAttribution: "© ICT Hamuga iMap",
  }),
  "bottom-right"
);

// Zoom + Compass (NavigationControl)
mapRef.current.addControl(
  new mlRef.current.NavigationControl({
    showZoom: true, // +/-
    showCompass: true, // compass/rotate reset
    visualizePitch: true, // pitch UI
  }),
  "bottom-right" // "top-left", "top-right", "bottom-left", "bottom-right"
);

// Current location (GeolocateControl)
mapRef.current.addControl(
  new mlRef.current.GeolocateControl({
    positionOptions: {
      enableHighAccuracy: true,
    },
    trackUserLocation: true,
    showUserLocation: true,
    showAccuracyCircle: true,
    fitBoundsOptions: { maxZoom: 16 },
    zoom,
  }),
  "bottom-right"
);

// === Autocomplete ===

// Autocomplete UI
HamugaImap.ui.autocomplete({
  container: "autocomplete",
  width: "600px",
  onSelection: (result) => {
    const { latitude: lat, longitude: lng } = result?.location || {};
    map.flyTo({ center: [lng, lat], zoom: 15 });

    const marker = HamugaImap.ui.marker();
    marker.setLngLat([lng, lat]).addTo(map);
  },
});

// Autocomplete API
HamugaImap.autocomplete({
  value: "regency",
  page: 1,
  perPage: 3,
})
  .then((result) => {
    console.log("result: ", result);
  })
  .catch((err) => {
    // handle error
  });

// === Routing ===

// Routing API
HamugaImap.routing({
  locations: [
    {
      lat: 47.918,
      lon: 106.9176,
    },
    {
      lat: 47.92,
      lon: 106.92,
    },
  ],
})
  .then((result) => {
    console.log("result: ", result);
  })
  .catch((err) => {
    // handle error
  });

// Routing Bus API
HamugaImap.routingBus({
  start: "47.927572261628114,106.93353687526832",
  end: "47.907956772246735,106.91491161586976",
  mode: ["WALK", "BUS"],
})
  .then((result) => {
    console.log("result: ", result);
  })
  .catch((err) => {
    // handle error
  });

// === POI ===

// POI API
HamugaImap.poi({
  area: false,
  categoryIds: [543],
  llx: 106.90699148188776,
  lly: 47.90622961174208,
  urx: 106.93673742840637,
  ury: 47.91933711330858,
  // "workHour": "open",
  // "name": "kfc",
  // "filter": "string",
  page: 1,
  size: 10,
})
  .then((result) => {
    console.log("result Poi API on html: ", result);
  })
  .catch((err) => {
    // handle error
  });

// POI Coordinate API
HamugaImap.poiCoordinate({
  lat: 47.91194077591632,
  lon: 106.92879515654936,
  zoom: 10,
})
  .then((result) => {
    console.log("result: ", result);
  })
  .catch((err) => {
    // handle error
  });

In your html

The MapLibre dependency is not necessary to install when using installation with the script tag.

Add the following script in your html file

Quickstart

Create a map

To create a map, first initialize the Hamuga iMap SDK with your publishable key. Then specify the HTML element where you want to render the map, by providing the element's ID, or the element object itself.

<html>
  <head>
    <!-- maplibre css and js -->
    <script src="https://unpkg.com/maplibre-gl@^5.15.0/dist/maplibre-gl.js"></script>
    <link
      href="https://unpkg.com/maplibre-gl@^5.15.0/dist/maplibre-gl.css"
      rel="stylesheet"
    />
    <!-- Hamuga iMap SDK css -->
    <script src="https://js.hamuga.mn/v0.0.1/hamuga-imap.min.js"></script>
    <link
      href="https://js.hamuga.mn/v0.0.1/hamuga-imap.min.css"
      rel="stylesheet"
    />
    <!-- Custom Style -->
    <style>
      html,
      body,
      main,
      #map {
        margin: 0;
        padding: 0;
        width: 100%;
        height: 100%;
      }

      aside {
        padding: 20px;
      }

      main {
        display: grid;
        grid-template-columns: 1fr 3fr;
      }

      .hamuga-imap-theme-dark aside {
        background-color: #111;
      }
    </style>
  </head>

  <body>
    <main>
      <aside>
        <div id="autocomplete"></div>
      </aside>
      <section>
        <div id="map"></div>
      </section>
    </main>

    <script type="text/javascript">
      // === SDK initialize ===
      HamugaImap.initialize({
        debug: true, // or false
        apiKey: "HAMUGA_IMAP_API_KEY",
        theme: "dark", // or 'light'
      });

      // === Create Map ===
      const map = HamugaImap.ui.map({
        container: "map", // OR document.getElementById('map')
        center: [106.9, 47.9],
        zoom: 12,
        attributionControl: false,
      });

      // === Add Map Controls ===

      // Get Maplibre
      const ml = HamugaImap.ui.maplibregl;

      // scale ruler
      map.addControl(new ml.ScaleControl({ maxWidth: 120, unit: "metric" }));

      // custom attribution
      map.addControl(
        new ml.AttributionControl({
          compact: true,
          customAttribution: "© ICT Hamuga iMap",
        }),
        "bottom-right"
      );

      // Zoom + Compass (NavigationControl)
      map.addControl(
        new ml.NavigationControl({
          showZoom: true, // +/-
          showCompass: true, // compass/rotate reset
          visualizePitch: true, // pitch UI
        }),
        "bottom-right" // "top-left", "top-right", "bottom-left", "bottom-right"
      );

      // Current location (GeolocateControl)
      map.addControl(
        new ml.GeolocateControl({
          positionOptions: {
            enableHighAccuracy: true,
          },
          trackUserLocation: true,
          showUserLocation: true,
          showAccuracyCircle: true,
          fitBoundsOptions: { maxZoom: 16 },
        }),
        "bottom-right"
      );

      //  === Autocomplete ===

      // Autocomplete UI
      HamugaImap.ui.autocomplete({
        container: "autocomplete",
        width: "600px",
        onSelection: (result) => {
          const { latitude: lat, longitude: lng } = result?.location || {};
          map.flyTo({ center: [lng, lat], zoom: 15 });

          const marker = HamugaImap.ui.marker();
          marker.setLngLat([lng, lat]).addTo(map);
        },
      });

      // Autocomplete API
      HamugaImap.autocomplete({
        value: "search text here",
        page: 1,
        perPage: 10,
      })
        .then((result) => {
          console.log("result: ", result);
        })
        .catch((err) => {
          // handle error
        });

      // === Routing ===

      // Routing API
      HamugaImap.routing({
        locations: [
          {
            lat: 47.918,
            lon: 106.9176,
          },
          {
            lat: 47.92,
            lon: 106.92,
          },
        ],
      })
        .then((result) => {
          console.log("result: ", result);
        })
        .catch((err) => {
          // handle error
        });

      // Routing Bus API
      HamugaImap.routingBus({
        start: "47.927572261628114,106.93353687526832",
        end: "47.907956772246735,106.91491161586976",
        mode: ["WALK", "BUS"],
      })
        .then((result) => {
          console.log("result: ", result);
        })
        .catch((err) => {
          // handle error
        });

      // === POI ===

      // POI API
      HamugaImap.poi({
        area: false,
        categoryIds: [543],
        llx: 106.90699148188776,
        lly: 47.90622961174208,
        urx: 106.93673742840637,
        ury: 47.91933711330858,
        workHour: "",
        name: "",
        filter: "",
        page: 1,
        size: 10,
      })
        .then((result) => {
          console.log("result Poi API on html: ", result);
        })
        .catch((err) => {
          // handle error
        });

      // POI Coordinate API
      HamugaImap.poiCoordinate({
        lat: 47.91194077591632,
        lon: 106.92879515654936,
        zoom: 10,
      })
        .then((result) => {
          console.log("result: ", result);
        })
        .catch((err) => {
          // handle error
        });
    </script>
  </body>
</html>