Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions common/preview/bundle.js

Large diffs are not rendered by default.

68 changes: 48 additions & 20 deletions common/preview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,42 +2,70 @@
<head>
<title>pelias autocomplete demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.3.1/dist/leaflet.css"
integrity="sha512-Rksm5RenBEKSKFjgI3a41vrjkw4EVPlJ3+OiI65vTjIdo9brlAacEuKOiQ5OFh7cOI1bkDwLqdLw3Zg0cRJAAQ=="
crossorigin=""/>
<script src="https://unpkg.com/leaflet@1.3.1/dist/leaflet.js"
integrity="sha512-/Nsx9X4HebavoBvEBuyp3I7od5tA0UzAxs+j83KgC8PU0kgB4XiK4Lfe4y4cgBtaRJQEIFCW+oC506aPT2L1zw=="
crossorigin=""></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/leaflet-geocoder-mapzen/1.9.4/leaflet-geocoder-mapzen.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/leaflet-geocoder-mapzen/1.9.4/leaflet-geocoder-mapzen.js"></script>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<style>
#map{ height: 800px; }
#map{ height: 100%; }
</style>
</head>
<body>
<div id="map"></div>

<script type="module" src="/bundle.js"></script>
<script>
var map = L.map('map', {
center:[42.35, -71.08],
zoom: 3,
minZoom:2,
scrollWheelZoom: false
});

var geocodingOptions = {
url: 'http://localhost:4000/v1',
expanded: true,
attribution: '<a href="https://openstreetmap.org/copyright">OpenStreetMap</a> and <a href=" https://geocode.earth/guidelines">others</a>'
};

L.control.geocoder(null, geocodingOptions).addTo(map);

L.tileLayer('http://tile.stamen.com/toner/{z}/{x}/{y}.png', {
L.tileLayer('https://tiles.stadiamaps.com/tiles/stamen_toner/{z}/{x}/{y}.png', {
attribution: 'Tiles by <a href="http://stamen.com">Stamen Design</a>',
maxZoom: 17,
minZoom: 1
}).addTo(map);

L.Control.searchbar = L.Control.extend({
onAdd: function (map) {
let container = L.DomUtil.create('div');
//For some reasons you need to insert a syntacially correct api_key. Otherwise it won't work and throws weird error messages about missing functions
container.innerHTML = `<div class="box">
<ge-autocomplete api_key='ge-0000000000000000'></ge-autocomplete>
<pre id="result"></pre>
</div>`
return container;
},
onRemove: function (map) { }
});
L.control.searchbar = function (opts) {
return new L.Control.searchbar(opts);
};
L.control.searchbar({ position: 'topleft' }).addTo(map);


const el = document.querySelector('ge-autocomplete')

el.addEventListener('change', ({ detail, currentTarget }) => {
console.log('change', currentTarget)
console.log(detail)
})

el.addEventListener('features', ({ detail, currentTarget }) => {
console.log('features', currentTarget)
console.log(detail)
})

el.addEventListener('select', ({ detail, currentTarget }) => {
console.log('select', currentTarget)
console.log(detail)
map.setView([detail.geometry.coordinates[1], detail.geometry.coordinates[0]], 14);

})

el.addEventListener('error', ({ detail, currentTarget }) => {
console.log('error', currentTarget)
console.error(detail)
});
</script>
</body>
</html>
</html>
7 changes: 7 additions & 0 deletions projects/australia/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/austria/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/belgium/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/brazil/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/denmark/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/france/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/germany/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/israel/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/italy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/jamaica/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/kyrgyzstan/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/las-vegas-metro/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/lithuania/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/los-angeles-metro/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/netherlands/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/new-york-city/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/north-america/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/norway/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,3 +110,10 @@ services:
cap_add: [ "IPC_LOCK" ]
security_opt:
- seccomp=unconfined
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/planet/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,3 +135,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/poland/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/portland-metro/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/san-jose-metro/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/singapore/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/south-america/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,3 +126,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"
7 changes: 7 additions & 0 deletions projects/texas/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,3 +128,10 @@ services:
volumes:
- "./pelias.json:/code/pelias.json"
- "./test_cases:/code/pelias/fuzzy-tester/test_cases"
preview:
image: nginx
container_name: pelias_preview
restart: always
ports: [ "127.0.0.1:3000:80" ]
volumes:
- "../../common/preview:/usr/share/nginx/html"