From 126747c901d7191045306d2d8f9ff850f4cd6381 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Tue, 24 Apr 2018 08:41:51 +0200 Subject: [PATCH] migrate to nextzen + geocode.earth nextzen api key obtained from the website ; a geocode.earth API key is needed for search. --- index.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 22c1d2f..b27d588 100755 --- a/index.js +++ b/index.js @@ -1,3 +1,6 @@ +const nextzen_api_key = "_zeXSryhSXmLLpEko7xG6w"; +const geocode_earth_api_key = "…………"; // request pending, add your own api key + var layers = [ { layer: 'boundaries', display: false, @@ -121,7 +124,7 @@ d3.select("#search-text").on("keydown",function(){ function search(text) { var text = document.getElementById('search-text').value; - d3.json("https://search.mapzen.com/v1/search?text="+text+"&api_key=search-owZDPeC", function(error, json) { + d3.json("https://api.geocode.earth/v1/search?text="+text+"&api_key=" + geocode_earth_api_key, function(error, json) { var latlon = json.features[0].geometry.coordinates; zoomTo(latlon); document.getElementById('search-text').value = ''; @@ -153,7 +156,7 @@ var zoom_out = zoom_controls.append("a") var info = map.append("div") .attr("class", "info") - .html('Mike Bostock | © OpenStreetMap contributors | Mapzen'); + .html('Mike Bostock | © OpenStreetMap contributors | Nextzen | geocode.earth'); zoomed(); setTimeout(sortFeatures, 1500); @@ -333,7 +336,7 @@ function renderTiles(d) { var svg = d3.select(this); var zoom = d[2]; - this._xhr = d3.json("https://tile.mapzen.com/mapzen/vector/v1/all/" + zoom + "/" + d[0] + "/" + d[1] + ".topojson?api_key=mapzen-R6PDPvd", function(error, json) { + this._xhr = d3.json("https://tile.nextzen.org/tilezen/vector/v1/256/all/" + zoom + "/" + d[0] + "/" + d[1] + ".topojson?api_key=" + nextzen_api_key, function(error, json) { var k = Math.pow(2, d[2]) * 256; // size of the world in pixels tilePath.projection() @@ -474,4 +477,4 @@ function exportify() { downloadA.href = url; svg2.remove(); -} \ No newline at end of file +}