JSPM

svg-world-map

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 113
  • Score
    100M100P100Q74578F
  • License ISC

Show a location on a world map.

Package Exports

  • svg-world-map

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (svg-world-map) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

svg-world-map

Render a world map with a pin at a specific location. Fiddle with it on the website.

map with pin at Berlin

npm version build status dependency status dev dependency status ISC-licensed

svg-world-map returns a virtual-dom <svg> node. You can either stringify it into a file or embed it into your Frontend stack.

Note that because shapes of all countries are quite a lot of data, this module weighs roughly 43k when browserified, minified and gzipped.

Installing

npm install svg-world-map

Usage

const map = require('svg-world-map')
const stringify = require('virtual-dom-stringify')

const myMap = map(81.8, 28.4) // Nepal

process.stdout.write(stringify(myMap))

API

maps(longitude, latitude, [opt])

opt is optional and has the following default values:

const defaults = {
    ocean: '#8df', // color of the ocean
    land: 'white', // color of the land
    mapWidth: 500, // width of the `<svg>`
    pin, // virtual dom node with the pin
    pinHeight: 8 // relative to map viewBox
}

Contributing

If you have a question, found a bug or want to propose a feature, have a look at the issues page.