forked from python-visualization/folium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add simple example demonstrating line()
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
'''Test of Folium polylines''' | ||
|
||
import folium | ||
|
||
# Coordinates are 15 points on the great circle from Boston to | ||
# San Francisco. | ||
# Reference: http://williams.best.vwh.net/avform.htm#Intermediate | ||
coordinates = [ | ||
[ 42.3581 , -71.0636 ], | ||
[ 42.82995815, -74.78991444], | ||
[ 43.17929819, -78.56603306], | ||
[ 43.40320216, -82.37774519], | ||
[ 43.49975489, -86.20965845], | ||
[ 43.46811941, -90.04569087], | ||
[ 43.30857071, -93.86961818], | ||
[ 43.02248456, -97.66563267], | ||
[ 42.61228259, -101.41886832], | ||
[ 42.08133868, -105.11585198], | ||
[ 41.4338549 , -108.74485069], | ||
[ 40.67471747, -112.29609954], | ||
[ 39.8093434 , -115.76190821], | ||
[ 38.84352776, -119.13665678], | ||
[ 37.7833 , -122.4167 ]] | ||
|
||
|
||
# Create the map and add the line | ||
m = folium.Map(location=[41.9, -97.3], zoom_start=4) | ||
m.line(coordinates, line_color='#FF0000', line_weight=5) | ||
|
||
m.create_map(path='line_example.html') |
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be included at the folium docs. It took me two days to find this feature!
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function is not working for me. I couldn't see the lines. I even thought that there is a problem with my code or I there is no coordinates passed, but at the end I found that there is a problem with the API.
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went to debug the exported html using Developer Tools to see if there is a problem from the Javascript side but it seems not showing any errors! Why it's not showing the line on map?
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @0x01Brain,
Wow, this is from a long time ago :)
My Folium repo is a fork of https://github.com/python-visualization/folium - so maybe this is best to discuss on the original repo.
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! API offered in this cannot be used. I always get error such as "'Map' object has no attribute 'lat_lng_popover' ". So how can I use the functions in this website? Also including line() function.
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @EileenFang, this Folium repo is a fork of https://github.com/python-visualization/folium. It would be best to have the discussion over on the original repository.
865eda4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But in this repository, it does not refer line() function.