diff --git a/.gitignore b/.gitignore
index 9beba72..7925793 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,5 @@ node_modules/
nbproject/
.idea/
bingkey.txt
+/.project
+/keys.js
diff --git a/README.md b/README.md
index a6a991f..86eada9 100644
--- a/README.md
+++ b/README.md
@@ -45,6 +45,9 @@ set ``BR.conf.profilesUrl`` in [config.js](config.js), e.g. uncomment:
BR.conf.profilesUrl = 'http://localhost:8000/profiles2/';
+3. add your API keys (optional)
+copy ``keys.js.template`` to ``keys.js`` and edit to add your keys
+
### Run
1. start BRouter server in the ``standalone`` directory with ``./server.sh`` or ``server.cmd`` (Windows)
diff --git a/config.js b/config.js
index 78ddf63..4a280c5 100644
--- a/config.js
+++ b/config.js
@@ -61,11 +61,6 @@
//BR.conf.profilesUrl = 'file://YOUR_PATH_TO/profiles2/';
}
- // COPYING: Please get your own Bing maps key at http://www.microsoft.com/maps/default.aspx
- //BR.conf.bingKeyUrl = 'bingkey.txt';
- // External URL for key retrieval, does not work locally on desktop
- BR.conf.bingKeyUrl = 'http://norbertrenner.de/key/bing.php';
-
// Removes default base layers when 'true'. Useful for only having custom layers (see below).
BR.conf.clearBaseLayers = false;
diff --git a/index.html b/index.html
index b06a7a3..3f2ab86 100644
--- a/index.html
+++ b/index.html
@@ -113,6 +113,7 @@
+
diff --git a/js/Map.js b/js/Map.js
index 5915ce1..a33de18 100644
--- a/js/Map.js
+++ b/js/Map.js
@@ -5,6 +5,8 @@ BR.Map = {
layersControl;
L.Icon.Default.imagePath = 'dist/images';
+
+ BR.keys = BR.keys || {};
var osmAttribution = '© OpenStreetMap contributors';
var maxZoom = 19;
@@ -55,17 +57,6 @@ BR.Map = {
+ '(CC-BY-SA 3.0 DE)'
});
- // COPYING: Please get your own Bing maps key at http://www.microsoft.com/maps/default.aspx
- var bing = new BR.BingLayer();
- BR.Util.get(BR.conf.bingKeyUrl, function (err, key) {
- if (err) {
- layersControl.removeLayer(bing);
- return;
- }
-
- bing._key = key;
- });
-
map = new L.Map('map', {
worldCopyJump: true
});
@@ -82,14 +73,17 @@ BR.Map = {
'OpenStreetMap.de': osmde,
'OpenTopoMap': topo,
'OpenCycleMap (Thunderf.)': cycle,
- 'Outdoors (Thunderforest)': outdoors,
- 'Bing Aerial': bing
+ 'Outdoors (Thunderforest)': outdoors
};
var overlays = {
'Cycling (Waymarked Trails)': cycling,
'Hiking (Waymarked Trails)': hiking
};
+ if (BR.keys.bing) {
+ baseLayers['Bing Aerial'] = new BR.BingLayer(BR.keys.bing);
+ }
+
if (BR.conf.clearBaseLayers) {
baseLayers = {};
}
diff --git a/keys.js.template b/keys.js.template
new file mode 100644
index 0000000..e3b9a11
--- /dev/null
+++ b/keys.js.template
@@ -0,0 +1,10 @@
+(function() {
+
+ // COPYING: Please get your own API keys from the sites listed below
+
+ BR.keys = {
+ // Bing maps, http://www.microsoft.com/maps/default.aspx
+ bing: ''
+ };
+
+})();