File: new-osm-urls.patch

package info (click to toggle)
libgeo-osm-tiles-perl 0.04-7
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 152 kB
  • sloc: perl: 463; makefile: 11
file content (20 lines) | stat: -rw-r--r-- 726 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Description: OSM has changed their short copyable URLs
Origin: vendor
Bug: https://rt.cpan.org/Ticket/Display.html?id=94148
Forwarded: https://rt.cpan.org/Ticket/Display.html?id=94148
Author: gregor herrmann <gregoa@debian.org>
Last-Update: 2014-08-14

--- a/downloadosmtiles.pl
+++ b/downloadosmtiles.pl
@@ -98,6 +98,10 @@
 sub selecttilescmdline
 {
     if ($opt{link}) {
+	# rewrite new style OSM links to old pattern
+	if ($opt{link} =~ /^http:\/\/(.+)\/#map=(\d+)\/(-?[\d.]+)\/(-?[\d.]+)/) {
+	    $opt{link} = "http://$1/?lat=$3&lon=$4&zoom=$2&layers=M";
+        }
 	die "Invalid link: $opt{link}\n"
 	    unless $opt{link} =~ /^http:\/\/.*\/\?lat=(-?\d+(?:\.\d+)?)\&lon=(-?\d+(?:\.\d+)?)\&zoom=(\d+)/;
 	my $lat = $1;