Get started with leaflet.pm CDN

MIT licensed

Perl module: Leaflet.pm - creates interactive maps using Leaflet library.

Tags:
  • leaflet
  • polygon management
  • geometry editing
  • map data
  • map overlay
  • polygon
  • geojson
  • leaflet-draw
  • data-field-geojson
  • ui-leaflet-draw

Stable version

Copied!

How to start using leaflet.pm CDN

perl #!/usr/bin/perl use strict; use warnings; use WWW::Curl; use JSON; my $curl = WWW::Curl->new(); my $url = 'https://api.openweathermap.org/data/2.5/weather?q=London&appid=YOUR_API_KEY'; $curl->get($url); my $response = $curl->content(); my $json = JSON->new()->decode($response); my $lat = $json->{coord}{lat}; my $lon = $json->{coord}{lon}; use Leaflet::PM qw(:all); my $map = Map->new( container => 'mapid', center => [$lat, $lon], zoom => 13, ); my $tile_layer = TileLayer->new( provider => 'OpenStreetMap', ); $map->add_layer($tile_layer); my $marker = Marker->new( position => [$lat, $lon], ); $map->add_layer($marker); $map->fit_bounds([$marker->get_position()]); $curl->cleanup();
Copied!
Copied!

All versions