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

@dmpbxo/mapa-gardenias

v1.0.8

Published

El mapa las gardenias muestra un canvas del proyecto de Inmobitec

Downloads

10

Readme

Mapa Gardenias

Mapa Gardenias es un proyecto que muestra el area en 3D del proyecto Gardenias. En este documento se explicará la forma de usar el paquete.

🏗 Instalación

npm i @dmpbxo/mapa-gardenias

🏁 Getting Started

Plantilla

Solo necesitamos un elemento div con un id donde se renderizará el mapa.

Y tambien es importante obtener el css de mapbox, para ello se deberá de establecer <link href='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css' rel='stylesheet' />

<!DOCTYPE html>
<html lang="es">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Mapa</title>
  <link href='https://api.mapbox.com/mapbox-gl-js/v2.7.0/mapbox-gl.css' rel='stylesheet' />
</head>

<body>
  <div id="map" style="width:100%; height: 100vh;"></div>
  <script src="main.js"></script>
</body>

</html>

Instancia

El paquete usa mapbox, por tanto, se deberá de registrar una cuenta en mapbox. Y deberá de generar un token y un estilo para el canvas. MapaGardenias necesita de un token, style, container y onLote callback.

| Parametros | Descripción | | :------------ | :------------ | | token | Token generado en mapbox | | style | Es el codigo de estilo generado en mapbox | | container | El ID donde se generará el canvas | | onLote | Callback que se acciona cuando se selecciona un lote |

import MapaGardenias from "@dmpbxo/mapa-gardenias";

// Instancia
const mapaGardenias = new MapaGardenias({
  token: "pk.eyJ1IjoiZG1wYiIsImEiOiJjbDBobHJ0eHQwOXN4M2ltbmoycm5qMzh5In0.hOuywcDqCkpcuYzEDn0nbA",
  style: "mapbox://styles/dmpb/cl0key28d002q15muz3944tt7",
  container: "map",
  onLote: (result: any) => {
    console.log(result);
  },
});

go

Para redirigirse hasta el centro del mapa, el método go nos ayudará para hacer ese efecto.

const go = <HTMLButtonElement>document.getElementById("go");

go.addEventListener("click", () => {
  mapaGardenias.go();
});

search

MapaGardenias consume la API de MiPortal para buscar un lote. Y una vez encontrado el lote, se redirigira en la ubicación exacta dentro del canvas. El método search recibe como parametros la manzana y el lote. Y devuelve una Promise

const mzInput = <HTMLInputElement>document.getElementById("mz");
const loteInput = <HTMLInputElement>document.getElementById("lote");
const search = <HTMLButtonElement>document.getElementById("search");

search.addEventListener("click", () => {
  const mz = mzInput.value;
  const lote = loteInput.value;

  const result = mapaGardenias.search(mz, lote);

  result.then((data: any) => {
    console.log(data);
  });
});