Skip to content

Commit

Permalink
Add simple example demonstrating line()
Browse files Browse the repository at this point in the history
  • Loading branch information
jwass committed Jan 8, 2014
1 parent e3be077 commit 865eda4
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions examples/line_example.py
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')

7 comments on commit 865eda4

@romanrdgz
Copy link

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!

@rgouzal
Copy link

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.

@rgouzal
Copy link

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?

@jwass
Copy link
Owner Author

@jwass jwass commented on 865eda4 Nov 11, 2016

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.

@EileenFang
Copy link

@EileenFang EileenFang commented on 865eda4 May 12, 2017

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.

@jwass
Copy link
Owner Author

@jwass jwass commented on 865eda4 May 12, 2017

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.

@EileenFang
Copy link

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.

Please sign in to comment.