Published
Edited
Nov 6, 2020
Insert cell
md`# Alternative Bus Map of Colombo`
Insert cell
import { LOCATION_INDEX } from '@nuuuwan/sl-locations'
Insert cell
import { getLocations, drawHBD } from '@nuuuwan/harry-beck-diagram'
Insert cell
Insert cell
ROAD_LIST = [
Object({
id: 'Ocean Line',
color: 'blue',
locations: [
'Kelaniya Rajamaha Viharaya',
'New Kelani Bridge',
'St. Lucias Cathedral',
'Wolvendaal Church',
'St. Anthonys Shrine',
'Jami Ul-Alfar Mosque',
'Khan Clock Tower',
'Colombo Fort Railway Station',
'Dutch Hospital',
'Old Parliament',
'Galle Face',
'Galle Face Hotel',
'Cinnamon Grand',
'Liberty Plaza',
'Barefoot',
'Majestic City',
'Dehiwala Junction',
'Mount Lavinia Beach'
]
}),

Object({
id: 'Beira Line',
color: 'orange',
locations: [
'Colombo Fort Railway Station',
'Pettah Floating Market',
'Kailawasanathan Temple',
'Lotus Tower',
'Town Hall',
'Viharamahadevi Park',
'National Museum',
'Lionel Wendt Art Centre',
'Geoffrey Bawas Home',
'Colombo University',
'Laksala',
'Asokaramaya Temple',
'Dehiwala Zoo',
'Bellanwila Temple',
'Attidiya Bird Sanctuary'
]
}),

Object({
id: 168,
color: 'green',
locations: [
'Galle Face',
'Seema Malakaya',
'Gangarama Temple',
'Paradise Road',
'Town Hall',
'General Hospital',
'Borella Tunnel',
'Gothami Temple',
'Royal Colombo Golf Course',
'Diyatha Uyana',
'Beddagana Park',
'Kotte Rajamaha Vihara',
'Urban Wetland Park'
]
}),
Object({
id: 174,
color: 'green',
locations: [
'Diyatha Uyana',
'Parliament Grounds',
'Jana Kala Kendraya',
'Diyasaru Park'
]
}),
Object({
id: 177,
color: 'red',
locations: [
'Majestic City',
'Laksala',
'Planetarium',
'Independence Square',
'Arcade',
'BMICH',
'Borella Tunnel',
'New Kelani Bridge'
]
})
]
Insert cell
drawHBD(
{
locations: LOCATION_LIST.map(id => LOCATION_INDEX[id]),
roads: ROAD_LIST
},
{
caption: 'Tourist Bus Map',
width: 1000,
height: 1000,
funcRoadColor: function(road) {
if (road.color) {
return road.color;
}
return '#ccc';
},
doEqualize: true,
ignoreNonRoadLocations: false,
ignoreNonRoads: false,
ignoreNonJunctions: false,
doBeck: true
}
)
Insert cell
drawHBD(
{
locations: CUSTOM_LOCATION_LIST,
roads: ROAD_LIST
},
{
caption: 'Tourist Bus Map',
width: 1000,
height: 1000,
funcRoadColor: function(road) {
if (road.color) {
return road.color;
}
return '#ccc';
},
doEqualize: false,
ignoreNonRoadLocations: false,
ignoreNonRoads: false,
ignoreNonJunctions: false,
doBeck: false,
roadWidth: 6
}
)
Insert cell
CUSTOM_LOCATION_LIST = []
.concat(
getLocations(LOCATION_MAP, [
'New Kelani Bridge',
'St. Lucias Cathedral',
'Wolvendaal Church',
'St. Anthonys Shrine',
'Jami Ul-Alfar Mosque',
'Khan Clock Tower',
'Colombo Fort Railway Station'
])
.concat(
getLocations(LOCATION_MAP, [
'Colombo Fort Railway Station',
'Dutch Hospital',
'Old Parliament',
'Galle Face'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Galle Face',
'Galle Face Hotel',
'Cinnamon Grand',
'Liberty Plaza',
'Barefoot',
'Majestic City'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Colombo Fort Railway Station',
'Pettah Floating Market',
'Kailawasanathan Temple',
'Lotus Tower',
'St. Josephs College',
'Town Hall'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Town Hall',
'Viharamahadevi Park',
'National Museum',
'Lionel Wendt Art Centre',
'Geoffrey Bawas Home',
'Colombo University',
'Laksala'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Galle Face',
'Seema Malakaya',
'Gangarama Temple',
'Paradise Road',
'Town Hall'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Town Hall',
'General Hospital',
'Borella Tunnel'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Laksala',
'Planetarium',
'Independence Square',
'Arcade',
'BMICH',
'Borella Tunnel'
])
)
.concat(
getLocations(LOCATION_MAP, [
'New Kelani Bridge',
'Kelaniya Rajamaha Viharaya'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Laksala',
'Asokaramaya Temple',
'Dehiwala Zoo',
'Bellanwila Temple',
'Attidiya Bird Sanctuary'
])
)

.concat(
getLocations(LOCATION_MAP, [
'Borella Tunnel',
'Gothami Temple',
'Royal Colombo Golf Course',
'Diyatha Uyana'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Diyatha Uyana',
'Beddagana Park',
'Kotte Rajamaha Vihara',
'Urban Wetland Park'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Diyatha Uyana',
'Parliament Grounds',
'Jana Kala Kendraya',
'Diyasaru Park'
])
)
.concat(
getLocations(LOCATION_MAP, [
'Majestic City',
'Dehiwala Junction',
'Mount Lavinia Beach'
])
)
// .concat(getLocations(LOCATION_MAP, []))
// .concat(getLocations(LOCATION_MAP, []))
// .concat(getLocations(LOCATION_MAP, []))
)
.concat([
Object({
id: 'Galle Face',
latLng: [2, 0],
angle: -90
}),
Object({
id: 'Colombo Fort Railway Station',
latLng: [3, 1],
angle: -45
}),
Object({
id: 'Majestic City',
latLng: [1, 0],
angle: 45
}),
Object({
id: 'Kelaniya Rajamaha Viharaya',
latLng: [3, 2.5],
angle: 45
})
])
Insert cell
LOCATION_MAP = Object({
'Colombo Fort Railway Station': [3, 1],
'New Kelani Bridge': [3, 2],
'Kelaniya Rajamaha Viharaya': [3, 2.5],
'Town Hall': [2, 1],
'Borella Tunnel': [2, 2],
Laksala: [1, 1],
'Galle Face': [2, 0],
'Majestic City': [1, 0],
'Mount Lavinia Beach': [0, 0],
'Attidiya Bird Sanctuary': [0, 1],
'Diyatha Uyana': [1.5, 2.5],
'Urban Wetland Park': [1, 2],
'Diyasaru Park': [1, 3]
})
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more