projects
/
osmrrze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
188cb5f
)
now also handles map baselayer selection.
author
osm@osm.rrze
<osm@osm.rrze.uni-erlangen.de>
Tue, 17 Jul 2012 08:51:09 +0000
(10:51 +0200)
committer
osm@osm.rrze
<osm@osm.rrze.uni-erlangen.de>
Tue, 17 Jul 2012 08:51:09 +0000
(10:51 +0200)
cgis/osm-map.pl
patch
|
blob
|
blame
|
history
diff --git
a/cgis/osm-map.pl
b/cgis/osm-map.pl
index d154ff945fba13b98cd78b002d9dcf353b43e138..6ee96e1dd248d447743f5bd51d0c38d26f151492 100755
(executable)
--- 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 $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; }
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; }
}
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);
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/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!<img src="(.*?)/staticmaplite\?.*?size=([^"&]+).*?"!<img src="$1/staticmaplite?center=$lat,$lon&zoom=$zoom&size=$2"!;
+ my $rest = '';
+ if (defined($baselayer)) {
+ $rest .= '&maptype=' . $baselayer;
+ }
+ $ll =~ s!<img src="(.*?)/staticmaplite\?.*?size=([^"&]+).*?"!<img src="$1/staticmaplite?center=$lat,$lon&zoom=$zoom&size=$2$rest"!;
}
print($ll);
}
}
print($ll);
}
This page took
0.05154 seconds
and
4
git commands to generate.