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

mapa-gcba

v1.0.0

Published

Mapa Interactivo de la Ciudad de Buenos Aires

Downloads

26

Readme

Mapa Interactivo

Una forma rápida y sencilla utilizar un mapa de la Ciudad Autónoma de Buenos Aires utilizando la librería Leaflet

Instalación

npm install mapa-gcba

Configuración

Estilos

Importar los estilos del paquete

import "mapa-gcba/dist/assets/css/main.css";

Crear una instancia de la clase MapaInteractivo

El constructor del MapaInteractivo recibe un parámetro obligatorio, que representa el id del elemento HTML donde se insertará el mapa

const map = new MapaInteractivo("mapa");

Etiqueta HTML contenedora de mapa

Crear la etiqueta donde se insertará el mapa. Además se deberán agregar estilos (height y width) para poder ver el mapa.

<div id="mapa"></div>
#mapa {
  height: 500px;
  width: 800px;
}

Mapa Interactivo

Opciones

La instancia del MapaInteractivo puede recibir un segundo parámetro options que permite definir ciertas configuraciones y funcionalidades del mapa. Estas opciones se dividen en params, language, texts, reverseOptions, showScaleControl y showLoadingControl.

Parámetro options:

| Opción | Tipo | Default | Descripción | | :----------------- | :-----: | :-----------------: | :------------------------------------------: | | params | object | Ver sección params | Definir las caraceterísticas del mapa | | reverseOptions | object | Ver sección reverse | Definir las opciones para el reversgeocoding | | language | string | es | Definir idioma (es o en) | | texts | object | Ver sección texts | Definir los mensajes a mostrar | | showScaleControl | boolean | false | Mostrar escala de mapa | | showLoadingControl | boolean | false | Mostrar mensaje de carga |

Opción params

| Opción | Tipo | Default | Descripción | | :----------------- | :------: | :----------------: | :--------------------------------------: | | center | Array | [-34.657, -58.678] | Centro del mapa | | zoom | Number | 12 | Nivel de zoom | | zoomControl | Boolean | true | Control de zoom | | dragging | Boolean | true | Arrastre de mapa | | scrollWheelZoom | Boolean | true | Zoom con rueda | | attributionControl | Boolean | false | Control de atribución | | doubleClickZoom | Boolean | false | Zoom con doble click | | touchZoom | Boolean | true | Zoom táctil | | tap | Boolean | true | Tocar para zoom | | attributionControl | Boolean | false | Control de atribución | | minZoom | Number | - | Zoom mínimo permitido | | maxZoom | Number | - | Zoom máximo permitido | | onClick | function | null | Callback al hacer click en el mapa | | onDblClick | function | null | Callback al hacer doble click en el mapa |

Opción reverseOptions

| Opción | Tipo | Default | Descripción | | :----- | :------ | :------ | :-----------------------------------------------------: | | active | boolean | false | Activar reversegeocoding | | type | string | address | Definir el tipo de reverse (address o places) | | radius | number | 100 | Definir el radio de búsqueda cuando el type es places |

Opción texts

Valores por defecto para el objeto texts

texts: {
    es: {
      loadingLayers: "Cargando capas...",
      loadingMaps: "Cargando Mapa Base...",
      loadingInformation: "Cargando información...",
      errorLoadingInformation:
        "Se produjo un error al acceder a la información. Reintente más tarde.",
    },
    en: {
      loadingLayers: "Loading layers...",
      loadingMaps: "Loading Base Map...",
      loadingInformation: "Loading information...",
      errorLoadingInformation: "An error ocurred. Please try again later.",
    },
  },

Métodos

getParamsOptions()

Retorna las opciones del atributo params

setParamsOptions(options)

Método Setter de los parámetros de params.

getReverseOptions()

Retorna las opciones de reverseOptions

setReverseOptions(options)

Método Setter de las opciones de reverseOptions

setLanguage(language)

Método Setter del idioma para los mensajes de texts. Valores permitidos para language: "en" o "es"

setMarkerView(lat, lng, popup?) Este método permite georeferenciar y agregar un marcador de acuerdo a las coordenadas ingresadas. La opción popup permite agregar un cuadro de diálogo informativo en formato html.

getMap()

Retorna la instancia interna del mapa

getOptions()

Retorna las todas configuraciones del Mapa

cleanMap() Limpia los marcadores del Mapa