Created
September 5, 2019 22:29
-
-
Save merylldindin/baf93fc2550a74e4e76c6059ddfbfbf1 to your computer and use it in GitHub Desktop.
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
# Initialize San Francisco mapping | |
map_center_coordinates = (37.7749, -122.4194) | |
m = folium.Map(location=map_center_coordinates, tiles="Stamen Terrain", zoom_start=12) | |
# Load the processed graph of San Francisco | |
trj = Trajectory('../datasets/sanfrancisco.jb') | |
obj = np.random.choice(list(trj.G.keys()), 6) | |
# Build five random objectives given one starting point | |
for i in range(5): | |
pth = trj.shortest_path(obj[0], obj[i+1]) | |
pts = np.asarray([np.asarray(e.split(':')).astype('float')[::-1] for e in pth]) | |
folium.PolyLine(pts, color="blue", weight=5, opacity=0.5).add_to(m) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment