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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dgtek-map

v1.7.4

Published

This package draws DGtek footprint polygons & checks the address to be in the footprint. This package provides a number of methods for creating, searching and updating the buildings data in DB. Uses web-worker, remote and local DB. For DGtek provisionin

Readme

dgtek-map-package


:clipboard: Installation

yarn add dgtek-map && mv node_modules/dgtek-map/dist/map.worker.js public

or

npm install dgtek-map && mv node_modules/dgtek-map/dist/map.worker.js public

:clipboard: How to use


Import package:

import DgtekMap from 'dgtek-map'

Start web-worker

initWorker.js:

If your app starts from root folder:

window[Symbol.for('map.worker')] = new Worker('map.worker.js')

If your app starts from subfolder (for example https://example.com/app/):

window[Symbol.for('map.worker')] = new Worker('/app/map.worker.js')

:memo: Work with map

Create container for map with id "container-for-map" and stylize it as you need:

<style>
  #container-for-map {
    position: relative;
    width: 70%;
    height: 70vh;
    margin: auto;
  }
</style>
<main>
  <figure id="container-for-map"></figure>
</main>

<script src="initWorker.js"></script>
<script src="dist/main.js"></script>

:clipboard: Get started

const map = new DGtekMap({
  container,
  center: { lat: -37.8357725, lng: 144.9738764 }
})

Map container will receive events

:page_with_curl: Events

:point_right: Selected address events

| event type | description | |-|-| | | Selected building is: | | on-net | on-net | | footprint | in the footprint | | construction-commenced | under construction | | coming-soon | coming soon | | not-available | N/A |

:point_right: List events

The array of results from the collection of buildings DB received

| event type | description | |-|-| | buildings-address-list | The list of addresses | | buildings-data-list | The list of base data ({ id, address, addressComponents }) |

:point_right: Search events

| event type | description | |-|-| | get-by-id | Get building description by id | | get-by-address | Get building description by address |

:point_right: UI events

| event type | description | |-|-| | submit-address | User pressed the button SUBMIT |

Event handler example:

const events = [
  'map-worker-is-ready',
  'on-net',
  'footprint',
  'construction-commenced',
  'coming-soon',
  'not-available',
  'buildings-address-list',
  'buildings-data-list',
  'submit-address',
  'get-by-id',
  'get-by-address'
]

const container = document.getElementById('container-for-map')
events.forEach(eventName => container.addEventListener(eventName, catchEvent))

function catchEvent (event) {
  console.group('Event handler outside package')
  console.log('Event type: ', event.type)
  console.log('Event data:\n', event.data)
  console.groupEnd('Event handler outside package')
}

You should write your own code for catchEvent


:page_with_curl: Methods

• change default host url

setHost (data)

• change default api key

setApiKey (data)

• get list of building's addresses from collection

getBuildingsList (collectionName)

• get list of building's data from collection

getBuildingsData (collectionName)

Building data: { id, address, addressComponents }

Collections: 'lit', 'footprint', 'build', 'soon', 'other'

• get list of 'on-net' buildings

getLIT ()

• get list of 'footprint' buildings

getFootprint ()

• get full description of building by it's id

getBuildingDataById (buildingId)

• get full description of building by it's address

getBuildingDataByAddress (address)

• save new building

postBuildingData (buildingData)

• update existing building data

putBuildingData (buildingId, buildingData)

Additional

:pushpin: You can catch events listed above on the worker' instance directly:

events.forEach(event => window[Symbol.for('map.worker')].addEventListener(event, catchEvent))

:pushpin: You can send requests directly to the worker

☕ Search for address:

window[Symbol.for('map.worker')].postMessage({
  action: 'search',
  store: 'lit',
  key: '81 Cecil St, South Melbourne VIC 3205, Australia'
})

☕ Get list of addresses:

window[Symbol.for('map.worker')].postMessage({ action: 'list', key: 'build' })

☕ Get list of addresses:

window[Symbol.for('map.worker')].postMessage({ action: 'data', key: 'soon' })

☕ Post new building:

window[Symbol.for('map.worker')].postMessage({ action: 'post', data })

☕ Patch building details:

window[Symbol.for('map.worker')].postMessage({ action: 'patch', key: buildingId, data })