]> sipb.mit.edu Git - ikiwiki.git/blobdiff - IkiWiki/Plugin/osm.pm
OSM plugin: new config option to specify the url to fetch maps from
[ikiwiki.git] / IkiWiki / Plugin / osm.pm
index 764767525485d9df1fda2175ec5e5e0c1f832f0e..21d1dce3f2f9692373a4f582009e8570a8cf9311 100644 (file)
@@ -67,6 +67,13 @@ sub getsetup () {
                        safe => 0,
                        rebuild => 1,
                },
                        safe => 0,
                        rebuild => 1,
                },
+               osm_map_url => {
+                       type => "string",
+                       example => "/tiles/\${z}/\${x}/\${y}.png",
+                       description => "Url to get map tiles from (if none specified, uses the openstreetmap server, see http://wiki.openstreetmap.org/wiki/Creating_your_own_tiles for more info on serving your own tiles)",
+                       safe => 0,
+                       rebuild => 1,
+               },
 
 }
 
 
 }
 
@@ -540,6 +547,8 @@ sub map_setup_code($;@) {
        my $name=shift;
        my %options=@_;
 
        my $name=shift;
        my %options=@_;
 
+       my $mapurl = $config{osm_map_url};
+
        eval q{use JSON};
        error $@ if $@;
                                
        eval q{use JSON};
        error $@ if $@;
                                
@@ -556,6 +565,10 @@ sub map_setup_code($;@) {
                $options{'kmlurl'} = urlto($map."/pois.kml");
        }
 
                $options{'kmlurl'} = urlto($map."/pois.kml");
        }
 
+       if ($mapurl) {
+               $options{'mapurl'} = $mapurl;
+       }
+
        return "mapsetup('mapdiv-$name', " . to_json(\%options) . ");";
 }
 
        return "mapsetup('mapdiv-$name', " . to_json(\%options) . ");";
 }