This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def custom_dc(conn, airports): | |
new_list = {} | |
i = 0 | |
json = [] | |
#since some country has hundreds of airports, which would cause 414 error | |
#separate the request to small pieces | |
if len(airports) < 20: | |
for i in range(len(airports)): | |
new_list["source[{}]".format(i)] = airports.loc[i, 'Vertex_ID'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def nearby_airport(conn, city, distance, maxHops): | |
#get geo info from input city | |
geolocator = Nominatim(user_agent="hackathon") | |
location = geolocator.geocode(city) | |
if not location: | |
st.sidebar.error("City not found!") | |
return | |
lat = location.latitude | |
lng = location.longitude |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, useState, Fragment } from 'react'; | |
import './Map.css'; | |
import Airport from './model/Airport.model'; | |
import Dropdown from 'react-dropdown'; | |
import 'react-dropdown/style.css'; | |
import { plainToClass } from "class-transformer"; | |
import { Button, Input, CircularProgress, Card, Grid, InputLabel, Paper } from '@material-ui/core'; | |
import { Alert, AlertTitle } from '@material-ui/lab'; | |
interface IMap { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const onSearchBtnClick = async () => { | |
//check whether source or terminal is defined | |
if (start === undefined || terminal === undefined) { | |
setError("Please select a start point or a terminal!") | |
return; | |
} | |
console.log(start.id === terminal.id); | |
if (start.id === terminal.id) { | |
setError("Start point and terminal are same!"); | |
return; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//when points change, draw marker on map | |
const addMarkers = (): void => { | |
if (points) { | |
points.map(marker => { | |
addMarker(marker); | |
}); | |
map?.fitBounds(bounds); | |
map?.panToBounds(bounds); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, useState } from 'react'; | |
import './Map.css'; | |
interface IMap { | |
mapType: google.maps.MapTypeId, | |
mapTypeControl?: boolean, | |
countries: string[], | |
} | |
type GoolgeLatLng = google.maps.LatLng; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
Streamlit, | |
StreamlitComponentBase, | |
withStreamlitConnection | |
} from "streamlit-component-lib"; | |
import { ReactNode} from "react"; | |
import Map from './MapComponent'; | |
class MainComponent extends StreamlitComponentBase { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useRef, useState } from 'react'; | |
import './Map.css'; | |
interface IMap { | |
mapType: google.maps.MapTypeId, | |
mapTypeControl?: boolean, | |
countries: string[], | |
} | |
type GoolgeLatLng = google.maps.LatLng; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'), | |
bodyParser = require('body-parser'), | |
port = process.env.port || 3030, | |
tgjs = require('tigergraph.js'), | |
cred = require('./config'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
app.use((req, res, next) => { | |
res.setHeader('Access-Control-Allow-Origin', "*"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cred = { | |
'HOST': 'YOUR_HOST', | |
"PASSWORD": "YOUR_PASSWORD", | |
"SECRET": "SECRET", | |
"TOKEN": "TOKEN", | |
} | |
module.exports = cred; |
NewerOlder