diff --git a/index.html b/index.html
index f48d2aa..c0a65f5 100644
--- a/index.html
+++ b/index.html
@@ -96,19 +96,31 @@
const toLongitude = parseFloat(toAirport.longitude);
const toLatitude = parseFloat(toAirport.latitude);
+ // if from == to, draw a point
+ var geometry;
+ if(fromAirport == toAirport) {
+ geometry = {
+ type: 'Point',
+ coordinates: [fromLongitude, fromLatitude]
+ };
+ }
+ else {
+ geometry = {
+ type: 'LineString',
+ coordinates: [
+ [fromLongitude, fromLatitude],
+ [toLongitude, toLatitude]
+ ]
+ };
+ }
+
return {
type: 'Feature',
properties: {
from,
to
},
- geometry: {
- type: 'LineString',
- coordinates: [
- [fromLongitude, fromLatitude],
- [toLongitude, toLatitude]
- ]
- }
+ geometry: geometry
};
});
@@ -129,10 +141,21 @@
'line-cap': 'round'
},
paint: {
- 'line-color': '#bd34eb',
- 'line-width': 4
+ 'line-color': '#ce42f5',
+ 'line-width': 2
}
});
+
+ map.addLayer({
+ id: 'points',
+ type: 'circle',
+ source: 'routes',
+ paint: {
+ 'circle-radius': 5,
+ 'circle-color': '#f00'
+ },
+ filter: ['==', '$type', 'Point']
+ });
}
function updateMap(csvData) {