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

exif-geo-utils

v1.0.1

Published

Lightweight GPS coordinate utilities for image geotagging — convert between DMS and decimal degrees, validate coordinates, calculate distances, and format for EXIF metadata.

Readme

exif-geo-utils

Lightweight GPS coordinate utilities for image geotagging — convert between DMS and decimal degrees, validate coordinates, calculate distances, and format for EXIF metadata.

Built for GeoImageTagger — an AI-powered image geotagging and metadata editor.

Install

npm install exif-geo-utils

Usage

Convert Decimal to DMS

import { decimalToDMS, formatDMS } from "exif-geo-utils";

const dms = decimalToDMS(43.6426, "lat");
// { degrees: 43, minutes: 38, seconds: 33.36, direction: "N" }

formatDMS(43.6426, "lat");
// "43°38'33.36\"N"

Convert DMS to Decimal

import { dmsToDecimal } from "exif-geo-utils";

dmsToDecimal({ degrees: 43, minutes: 38, seconds: 33.36, direction: "N" });
// 43.6426

Format for EXIF Metadata

import { toExifGPS, fromExifGPS } from "exif-geo-utils";

const exif = toExifGPS({ latitude: 43.6426, longitude: -79.3871 });
// {
//   GPSLatitude: [43, 38, 33.36],
//   GPSLatitudeRef: "N",
//   GPSLongitude: [79, 23, 13.56],
//   GPSLongitudeRef: "W"
// }

const coord = fromExifGPS(exif);
// { latitude: 43.6426, longitude: -79.3871 }

Parse DMS Strings

import { parseDMSString, parseCoordinateString } from "exif-geo-utils";

parseDMSString("43°38'33.36\"N");
// 43.6426

parseCoordinateString("43.6426, -79.3871");
// { latitude: 43.6426, longitude: -79.3871 }

Validate Coordinates

import { isValidCoordinate } from "exif-geo-utils";

isValidCoordinate({ latitude: 43.6426, longitude: -79.3871 }); // true
isValidCoordinate({ latitude: 999, longitude: -79.3871 });      // false

Calculate Distance (Haversine)

import { haversineDistance } from "exif-geo-utils";

haversineDistance(
  { latitude: 48.8566, longitude: 2.3522 },   // Paris
  { latitude: 51.5074, longitude: -0.1278 }    // London
);
// 343556 (meters)

Generate Map URLs

import { toGoogleMapsURL, toOSMURL } from "exif-geo-utils";

toGoogleMapsURL({ latitude: 43.6426, longitude: -79.3871 });
// "https://www.google.com/maps?q=43.6426,-79.3871"

toOSMURL({ latitude: 43.6426, longitude: -79.3871 });
// "https://www.openstreetmap.org/?mlat=43.6426&mlon=-79.3871#map=15/43.6426/-79.3871"

Bounding Box

import { boundingBox } from "exif-geo-utils";

boundingBox({ latitude: 43.6426, longitude: -79.3871 }, 1000);
// { north: 43.6516, south: 43.6336, east: -79.3747, west: -79.3995 }

API Reference

| Function | Description | |---|---| | decimalToDMS(decimal, type) | Convert decimal degrees to DMS | | dmsToDecimal(dms) | Convert DMS to decimal degrees | | coordinateToDMS(coord) | Convert coordinate pair to DMS | | dmsToCoordinate(dms) | Convert DMS pair to coordinate | | toExifGPS(coord) | Format coordinate for EXIF GPS tags | | fromExifGPS(exif) | Parse EXIF GPS tags to coordinate | | isValidLatitude(lat) | Validate latitude (-90 to 90) | | isValidLongitude(lng) | Validate longitude (-180 to 180) | | isValidCoordinate(coord) | Validate coordinate pair | | haversineDistance(a, b) | Distance between two points in meters | | parseDMSString(input) | Parse DMS string to decimal | | parseCoordinateString(input) | Parse "lat, lng" string | | formatDMS(decimal, type) | Format decimal as DMS string | | formatCoordinateDMS(coord) | Format pair as DMS string | | formatCoordinateDecimal(coord) | Format pair as decimal string | | toGoogleMapsURL(coord) | Google Maps link | | toOSMURL(coord, zoom?) | OpenStreetMap link | | boundingBox(center, radius) | Bounding box around a point |

Why this package?

Working with GPS coordinates in image metadata is surprisingly tricky. Different tools use different formats — EXIF stores GPS as arrays of degrees/minutes/seconds, Google Maps uses decimal degrees, and many cameras output DMS strings with direction letters.

This package was extracted from GeoImageTagger, where we handle thousands of coordinate conversions daily across our image tools:

  • Metadata Viewer — reads GPS coordinates from EXIF, IPTC, and XMP tags and displays them on an interactive map. Uses fromExifGPS() and toGoogleMapsURL() under the hood.
  • Metadata Editor — lets users manually set or correct GPS coordinates in their photos. Uses toExifGPS() to write coordinates back to EXIF format and isValidCoordinate() for input validation.
  • AI Location Finder — uses AI to detect where a photo was taken from visual landmarks. Returns decimal coordinates that are converted to EXIF-compatible format using coordinateToDMS().
  • EXIF Remover — strips GPS and other sensitive metadata from images before sharing online. Uses coordinate parsing to show users exactly what location data is being removed.

Common workflows

| If you need to... | Use this with... | |---|---| | Add GPS to photos for Local SEO | GeoImageTagger + toExifGPS() | | View where a photo was taken | Metadata Viewer + fromExifGPS() | | Remove location data for privacy | EXIF Remover | | Compress geotagged images | Image Compressor (preserves metadata) | | Convert HEIC to JPG with GPS intact | Image Converter | | Edit photos and keep metadata | Image Editor | | Add watermarks to geotagged photos | Watermark Tool |

All tools are free, work in the browser, and require no sign-up.

License

MIT © Tosief Abbas