File tree Expand file tree Collapse file tree 4 files changed +14
-0
lines changed
Expand file tree Collapse file tree 4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ Parameters that can be used (can be passed to the app server as GET query params
3030| imagemin | enable lossless compression with [ optipng] ( https://github.com/imagemin/imagemin-optipng ) / [ jpegtran] ( https://github.com/imagemin/imagemin-jpegtran ) | ` false ` |
3131| oxipng | enable losslsess compression with [ oxipng] ( https://github.com/shssoichiro/oxipng ) | ` false ` |
3232| arrows | render arrows to show the direction of linestrings | ` false ` |
33+ | scale | enable render a scale ruler (boolean or [ a json options object] ( https://leafletjs.com/reference-1.6.0.html#control-scale-option ) ) | ` false ` |
3334
3435## How to use
3536
Original file line number Diff line number Diff line change 1+ import { Control } from "leaflet" ;
2+
13export = _default ;
24
35interface OsmStaticMapsOptions {
@@ -96,6 +98,12 @@ interface OsmStaticMapsOptions {
9698 * @defaultValue `false`
9799 */
98100 arrows ?: boolean ;
101+
102+ /**
103+ * enable render a scale ruler (boolean or [a json options object](https://leafletjs.com/reference-1.6.0.html#control-scale-option))
104+ * @defaultValue `false`
105+ */
106+ scale ?: boolean | Control . ScaleOptions ;
99107}
100108
101109/** Renders a map controlled by the options passed and returns an image */
Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ module.exports = function(options) {
4040 options . imagemin = options . imagemin || false ;
4141 options . oxipng = options . oxipng || false ;
4242 options . arrows = options . arrows || false ;
43+ options . scale = ( options . scale && ( typeof options . scale === 'string' ? options . scale : JSON . stringify ( options . scale ) ) ) || false ;
4344
4445 const html = replacefiles ( template ( options ) ) ;
4546
Original file line number Diff line number Diff line change 6363 } ) ;
6464 map . attributionControl . setPrefix ( '' ) . addAttribution ( '{{ attribution }}' ) ;
6565
66+ { { #if scale } }
67+ L . control . scale ( { { { scale} } } ) . addTo ( map ) ;
68+ { { / i f } }
69+
6670 { { #if geojson } }
6771 var myIcon = L . icon ( {
6872 iconUrl : "data:image/png;base64,//markericonpng//" ,
You can’t perform that action at this time.
0 commit comments