Leaflet TrueSize

A plugin for easily comparing sizes of geographical shapes

Installation

Install with npm/yarn:

npm install leaflet-truesize

Or download the minified library from unpkg or jsDelivr.

<script src="https://unpkg.com/leaflet-truesize"></script>

Usage Example

import L from 'leaflet';
import 'leaflet-truesize';

// create leaflet map ...

const geojsonFeature = {
  type: 'Feature',
  properties: {},
  geometry: {
    type: 'Polygon',
    coordinates: [[
      [14.7656, 50.9860],
      [19.0283, 49.1529],
      [24.1259, 50.2893],
      [21.3134, 54.8766]
    ]]
  }
};

const trueSizeLayer = new L.trueSize(geojsonFeature, {
  color: '#FF0000',
  weight: 1,
  opacity: 1,
  dashArray: '7, 10',
}).addTo(map);
        

Creation

Factory
Description
L.trueSize(geojsonFeature, options) You need to pass the first paramter data in order to create a truesize layer. It has to be a single GeoJSON feature (Polygon or LineString). The options parameter is not required.

Options

Option
Type
Default
Description