diff --git a/.firebaserc b/.firebaserc new file mode 100644 index 0000000..f9fc89e --- /dev/null +++ b/.firebaserc @@ -0,0 +1,5 @@ +{ + "projects": { + "default": "maps-22434" + } +} diff --git a/.gitignore b/.gitignore index 30bc162..6717adb 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -/node_modules \ No newline at end of file +node_modules +.firebase \ No newline at end of file diff --git a/firebase.json b/firebase.json new file mode 100644 index 0000000..c8b76f1 --- /dev/null +++ b/firebase.json @@ -0,0 +1,10 @@ +{ + "hosting": { + "public": "src/public", + "ignore": [ + "firebase.json", + "**/.*", + "**/node_modules/**" + ] + } +} diff --git a/src/public/404.html b/src/public/404.html new file mode 100644 index 0000000..5dfab36 --- /dev/null +++ b/src/public/404.html @@ -0,0 +1,14 @@ + + + + + + Maps - 404 page not found + + + + + +

404 - page not found

+ + diff --git a/src/public/index.html b/src/public/index.html index 635e588..425ffb1 100644 --- a/src/public/index.html +++ b/src/public/index.html @@ -1,5 +1,4 @@ - @@ -47,6 +46,8 @@ var points = [
+ + - - \ No newline at end of file diff --git a/src/public/js/search.js b/src/public/js/search.js index 8bada35..b3979c4 100644 --- a/src/public/js/search.js +++ b/src/public/js/search.js @@ -31,25 +31,48 @@ function getDirection(){ response.body.routes && response.body.routes.length ) { - console.log("route", response.body.routes[0]) - geojson = response.body.routes[0].geometry - map.addSource('route', { - type: 'geojson', - data: { - type: "FeatureCollection", - features: [ - { - type: "Feature", - properties: {}, - geometry: geojson - } - ] - } - }) + console.log("route", response.body.routes[0]); + drawRoute(response.body.routes[0]); } }); } +function drawRoute(route){ + geojson = route.geometry + if(map.getLayer('route')) + map.removeLayer('route') + if(map.getSource('route')) + map.removeSource('route') + map.addSource('route', { + type: 'geojson', + data: { + type: "FeatureCollection", + features: [ + { + type: "Feature", + properties: {}, + geometry: geojson + } + ] + } + }) + + map.addLayer({ + id: 'route', + type: 'line', + source: 'route', + layout: { + 'line-cap': 'round', + 'line-join': 'round' + }, + paint: { + 'line-blur': 0, + 'line-color': '#0000FF', + 'line-width': 15 + } + }) +} + function flyTo(target){ var mapboxClient = mapboxSdk({ accessToken: mapboxgl.accessToken }); d = mapboxClient.geocoding.forwardGeocode({