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 🙏

© 2024 – Pkg Stats / Ryan Hefner

coordenadas-utm

v1.0.3

Published

Converte coordenadas geográficas em UTM e vice-versa

Downloads

23

Readme

coordenadas-utm

Coordenadas-utm é uma biblioteca JavaScript que transforma coordenadas geográficas em grau para coordenadas UTM, e vice-versa, de maneira simplificada. A conversão retorna um resultado bem próximo, portanto, os resultados não são 100% exatos.

Instalação

npm install coordenadas-utm

Utilização

Importando

Para realizar a importação utilize a sintaxe apropriada para o ambiente em que você está trabalhando. Neste exemplo, utilizaremos a palavra "coordenadas", que será usada nos exemplos abaixo

const coordenadas = require("coordenadas-utm");
// ou
import coordenadas from "coordenadas-utm";

Função 'geographicToUTM'

Essa função transforma coordenadas geográficas em coordenadas UTM

coordenadas.geographicToUTM({
  latitude: { degree: 20, minute: 14, second: 5.47 },
  longitude: { degree: 51, minute: 3, second: 30.46 },
  datum: "sad69",
  hemisphereLongitude: "oeste",
  hemisphereLatitude: "sul",
});
// { x: 493893.7599313202, y: 7762520.733886789 }

Função 'UTMToGeographic'

Essa função transforma coordenadas UTM em coordenadas geográficas

coordenadas.UTMToGeographic({
  x: 493893.842883,
  y: 7762520.599209,
  datum: "sad69",
  hemisphereLatitude: "sul",
  zone: 22,
});
// {
//   latitude: `-20° 14' 5.474379541697374"`,
//   longitude: `-51° 3' 30.457142594000857"`
// }

Configurações

É possível passar um objeto de configurações em ambas as funções logo após o objeto de dados, para se obter um resultado personalizado

const config = {
  mask: "String no formato em que o dado será retornado, substituindo os colchetes pelos seus respectivos valores",
  fixed: "Number que define a quantidade de dígitos após o ponto decimal",
};
coordenadas.geographicToUTM(
  {
    latitude: { degree: 20, minute: 14, second: 5.47 },
    longitude: { degree: 51, minute: 3, second: 30.46 },
    datum: "sad69",
    hemisphereLongitude: "oeste",
    hemisphereLatitude: "sul",
  },
  {
    mask: "[x]m, [y]m",
    fixed: 2,
  }
);
// 493893.76m, 7762520.73m
// [x] = substitui pelo valor de X
// [y] = substitui pelo valor de y

coordenadas.UTMToGeographic(
  {
    x: 493893.842883,
    y: 7762520.599209,
    datum: "sad69",
    hemisphereLatitude: "sul",
    zone: 22,
  },
  {
    mask: "[signal][dd]d [mm]m [ss]s",
    fixed: 2,
  }
);
// { latitude: '-20d 14m 5.47s', longitude: '-51d 3m 30.46s' }
// [signal] = substitui pelo sinal (positivo não terá sinal de +)
// [dd] = substitui pelo grau
// [mm] = substitui pelo minuto
// [ss] = substitui pelo segundo