Render a world map with a pin at a specific location. Fiddle with it on the website.
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.
The data is from world.geo.json.
npm install svg-world-map
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))
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
}
svg-patterns
– Create SVG patterns programmatically to visualize data.svg-radar-chart
– A reusable radar chart in SVG.
npm test
is a regression test: It compares the generated output, to a example/berlin.svg
, which has been manually checked by me. If you introduce a change that changes the output, check it manually and commit it as example/berlin.svg
.
If you have a question, found a bug or want to propose a feature, have a look at the issues page.