npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@giscience/ol-print-layout-control

v1.0.2

Published

An extension of an OpenLayers Control. It Helps the user to define a map area that fits to the desired output page format and orientation.

Downloads

68

Readme

status: experimental

ol-print-layout-control

Add this OpenLayers-Control to your OpenLayers-Map.

It Helps the user to define a map area that fits to the desired output page format and orientation.

Works with ol@^7.0.0.

https://user-images.githubusercontent.com/2814068/195790425-99978d1a-6619-47a9-93b5-8c642664af5e.mp4

Usage

Browser

Load ol-print-layout-control.js after OpenLayers.

It will be available as new ol.control.PrintLayout()

<script src="https://unpkg.com/@giscience/ol-print-layout-control"></script>
<link rel="stylesheet" href="https://unpkg.com/@giscience/ol-print-layout-control/dist/ol-print-layout-control.css" />

<script>
const map = new ol.Map({
    target: 'map',
    view: new ol.View({
        center: ol.proj.fromLonLat([8.68, 49.41]),
        zoom: 15
    }),
    layers: [
        new ol.layer.Tile({
            source: new ol.source.OSM()
        })
    ]
});

const printLayoutControl = new ol.control.PrintLayout({
    format: PAPER_FORMAT.A3,
    orientation: ORIENTATION.LANDSCAPE,
    margin: {top: 2, bottom: 2, left: 2, right: 2}
});
map.addControl(printLayoutControl);
</script>

Typescript and bundlers

Install the npm package: @giscience/ol-print-layout-control

After import from the module it will be available as new PrintLayout().

npm install @giscience/ol-print-layout-control

Docs

Table of Contents

PrintLayout

Extends Control

The print-layout-control. Add an instance of this to your OpenLayers Map.

Parameters

  • opt_options Options (optional, default {})
  • Options {format: 'A4', orientation: 'portrait', margin: {top: 2, bottom: 2, left: 2, right: 2}}] opt_options

getOrientation

setOrientation

Parameters

  • orientation ORIENTATION

getFormat

setFormat

Parameters

  • format any

getMargin

Returns Margin

setMargin

Parameters

getBbox

getBboxAsLonLat

getScaleDenominator

Computes the scale denominator for the printed map

getPrintBoxSizeInDots

Get the print box size (width, height) in dots (px) for printing.

This is useful to determine the OGC-WMS params 'WIDTH' and 'HEIGHT'

Parameters

  • dpi {number} the desired print resolution in dots-per-inch (dpi) (optional, default 192)

Returns {width: number, height: number}

getPrintBoxSizeInMM

MarginProps

Type: {top: number, bottom: number, left: number, right: number}

Properties

Margin

Extends OlObject

The Margin Class to set paper margins in cm.

Parameters

  • marginProps Partial<MarginProps> (optional, default {})

getProperties

Returns MarginProps

getTop

setTop

Parameters

getBottom

setBottom

Parameters

getLeft

setLeft

Parameters

getRight

setRight

Parameters

Related

Originally ol-print-layout-control has been developed for the SketchMapTool.