Allows to get static map images from Node.js
npm install staticmapAbout
========
Allows to get static map images.
Installation
===============
``
`
$ npm install staticmap
`
Example
==========
js
`
const staticmap = require("staticmap");
staticmap.getMap(staticmap.png({ width: 500, height: 500 }), 45.4724, -73.4520, 12)
.then((image) => {
image.save('out1.png');
})
.catch((err) => {
console.log(err);
});
staticmap.getBox(staticmap.png({ width: 500, height: 500 }), 48.436034, 10.684891, 48.295985, 11.042633)
.then((image) => {
image.save('out2.png');
})
.catch((err) => {
console.log(err);
});
tileUrl
Documentation
================
$3
Object containing default values of and tileSize.
`
js
`
{
tileUrl: 'http://tile.openstreetmap.org/{z}/{x}/{y}.png',
tileSize: 256
}
opts
$3
Creates new instance of Map class using that is an object containing tileUrl and tileSize and proxy properties.
Image
$3
Creates instance of class that is wrapper for require('node-png').PNG class. You can provide a custom wrapper for an arbitrary image manipulation library.
Image
Custom class must contain the following members:
data
#### Property: width
Width of image in pixels.
#### Property: height
Height of image in pixels.
#### Method: drawImage(data, x, y, callback)
Helper for image manipulation, draws image represented by raw to current image (at x, y).
lat
Class: Map
Instance of Map class that is used to fetch tiles and to draw them in image.
$3
Fetches tiles and draws map with center at , lon coordinates. The zoom value of zoom is used to get appropriate tiles.
callback
Optional gets two arguments (err, image).
Image
$3
$3
$3
Class: Image
Default class representing resulting images. is wrapper for require('node-png').PNG class.
longitude
$3
$3
$3
Starts converting data to PNG file Stream.
$3
Function is being added to object automatically. Allows to translate a to x coordinate on this image.
latitude
$3
Function is being added to object automatically. Allows to translate a to y coordinate on this image.
require('node-png').PNG` class.
$3
$3
$3
Instance of
License
=========
The MIT License