From f01e50b19b460ade3c717f41eb89554abbe884ba Mon Sep 17 00:00:00 2001 From: "osm@osm.rrze" Date: Tue, 17 Jul 2012 10:51:09 +0200 Subject: [PATCH] now also handles map baselayer selection. --- cgis/osm-map.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cgis/osm-map.pl b/cgis/osm-map.pl index d154ff9..6ee96e1 100755 --- a/cgis/osm-map.pl +++ b/cgis/osm-map.pl @@ -15,6 +15,7 @@ print("Content-type: text/html\n\n"); my $lon = -999.0; my $lat = -999.0; my $zoom = -1; +my $baselayer = undef; if (defined(param('lon'))) { $lon = param('lon'); unless ($lon =~ m/^-{0,1}\d+\.\d+$/) { $lon = -999.0; } @@ -30,6 +31,16 @@ if (defined(param('zoom'))) { unless ($zoom =~ m/^\d+$/) { $zoom = -1; } if (($zoom < 0) || ($zoom > 30)) { $lat = -1; } } +if (defined(param('layers'))) { + my @layerlist = ('osmde', 'osmorg'); + my $layers = param('layers'); + my $i; + for ($i = 0; $i < int(@layerlist); $i++) { + if (substr($layers, $i, 1) eq 'B') { # This is our baselayer + $baselayer = $layerlist[$i]; + } + } +} my $OLF; unless (open($OLF, '<' . $openlayerstemplate)) { print("Sorry, failed to read my map template.\n"); exit(0); @@ -48,7 +59,11 @@ while ($ll = <$OLF>) { $ll =~ s/var\s+zoom\s*=\s*\d+;/var zoom = $zoom;/; } if (($lon >= -180.0) && ($lat >= -180.0) && ($zoom >= 0)) { # All values required in that case - $ll =~ s!