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

idris-lv03

v0.3.0

Published

Wrapper for the LV03 (swiss) projection for leaflet

Downloads

4

Readme

idris-lv03

A wrapper to use the swiss LV03 projection with leaflet

Setup

Create a folder myProject for your project

$ mkdir myProject
$ cd myProject

Install

Initialise npm and install idris-maps

$ npm init
$ npm install idris-lv03 --save

Copy the myProject/node_modules/idris-lv03/public folder to myProject/public

If watchify is not installed, install it

$ sudo npm install watchify -g

Create a main.js file and compile it into myProject/public/script.js with watchify

$ watchify main.js -o public/script.js

You can see the result by opening public/index.html

To publish on your server just copy the public folder

Use

In main.js, require idris-lv03

var lv03 = require('idris-lv03')

Initialise

Path to leaflets images folder

Set the path to the images folder, if it is in the same folder as index.html:

var imagePath = 'images'

Center and zoom level at start

Set the center and zoom level of the map at start

  • In LV03 coordinates as x and y
var start = {
	x: 182273,
	y: 538745,
	zoom: 22
}
  • In WGS84 coordinates as lat and lng
var start = {
	lat: 46.7888,
	lng: 6.6364,
	zoom: 22
}

Initialise with lv03.init()

Initialise the map with the start point and the imagePath. It returns a map variable.

lv03.init(start, imagePath, function(map) {
	// the rest of your code goes in here
})

Add WMS tiles

A WMS service needs the following keys:

  • url the URL to the service
  • format the format of the tiles, default is image/png
  • attr proper attribution to the provider
  • minZoom, default is 0
  • maxZoom, default is 28

To add the r-pod_yverdon_cygnes layer from HEIGVD-WMS-RPOD for example

Create the configuration

var cygnes = {
	url: 'http://ogc.heig-vd.ch/mapserver/wms?',
	minZoom: 22,
	format: 'image/jpeg',
	attr: '© HEIG-VD'
}

... and add the layer with lv03.wms(map, [CONFIGURATION])

lv03.init(start, imagePath, function(map) {
	lv03.wms(map, cygnes)
})

WMS services that I know of that do not require authentification:

Add features in WGS84 coordinates

Within the callback of lv03.init(), you can add any type of leaflet layer (such as L.marker(), L.geoJson() ...) with coordinates in WGS84

lv03.init(start, imagePath, function(map) {
	L.marker([46.7888,6.6364]).addTo(map)
})

Add a marker in LV03 coordinates

You can add a marker in LV03 coordinates using the lv03.point(map, coordinates) function where coordinates is an array with x and y: [x,y]

lv03.init(start, imagePath, function(map) {
	lv03.point(map, [182273,538745])
})