Socket
Socket
Sign inDemoInstall

@geoblocks/print

Package Overview
Dependencies
21
Maintainers
5
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @geoblocks/print

This project provides low level functionalities for rendering OpenLayers layers to images of arbitrary resolution.


Version published
Weekly downloads
1.4K
increased by34.17%
Maintainers
5
Install size
193 kB
Created
Weekly downloads
 

Readme

Source

Geoblocks print

This project provides low level functionalities for rendering OpenLayers layers to images of arbitrary resolution.

Supported layers:

  • Mapbox Vector Tiles (MVT);

Supported styles:

  • plain OpenLayers style functions;
  • MapBox style processed by the ol-mapbox-style library.

Supported rendering methods:

  • OpenLayers render API (feature complete, default);
  • OpenLayers immediate API (basic, enable with MVTEncoder.useImmediateAPI = true).

Demo

https://geoblocks.github.io/print

image

Using

npm i @geoblocks/print
import MVTEncoder from '@geoblocks/print';
const r = await new MVTEncoder().encodeMVTLayer({
  layer, // a plain OpenLayers MVT layer
  tileResolution, // the resolution to use for fetching features
  styleResolution, // the resolution to use for styling features
  printExtent, // the extent to print
  canvasSize, // the target size in dots of the rendered layer (depends of the dpi)
});

The result is tiled so that each image is reasonably big. Each tile result contains:

  • a base64 encoded image: r[i].baseURL;
  • the OL extent for this image: r[i].extent.

Contributing

contributing

FAQs

Last updated on 19 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc