1.1.0 • Published 5 months ago

maptoimage v1.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

MapToImage

Description

This is a Node.js package that allows you to convert a map to an image. You can set the dimensions of the image, the zoom level, the center of the map, and the tile servers you wish to use.

Installation

npm install maptoimage

Usage

const { mapToImage } = require("maptoimage");
const fs = require("fs");

(async () => {
	const img = mapToImage({
		"image": {
			"dimensions": {
				"width": 1280,
				"height": 720
			}
		},
		"map": {
			"center": {
				"lat": 39.67321,
				"lng": -104.95140
			},
			"zoom": 5,
			"layers": [
				"https://tile.openstreetmap.org/{z}/{x}/{y}.png",
				// https://mesonet.agron.iastate.edu/GIS/ridge.phtml
				"https://mesonet.agron.iastate.edu/cache/tile.py/1.0.0/ridge::USCOMP-N0Q-0/{z}/{x}/{y}.png",
			]
		}
	});
	fs.writeFileSync("map.png", img.png().toBuffer());
})();

License

This project is licensed under the MIT License - see the LICENSE file for details.

Please remember that the tile servers you use may have their own licenses.

1.1.0

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago