Skip to content

Add style for timestamped geojson #627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

soymsk
Copy link
Contributor

@soymsk soymsk commented May 30, 2017

Timestamped geojson plugin cannot add style for features, so I've made them in properties.

Multi-colored lines can be :

features = [
    {
        "type": "Feature",
        "geometry": {
            "type": "LineString",
            "coordinates": l.coordinates,
        },
        "properties": {
            "times": l.dates,
            "style": {
                "color":  l.color, # Add geojson style
            }
        }
    }
for l in lines]
folium.plugins.TimestampedGeoJson({
    "type": "FeatureCollection",
    "features": features,
}, period="PT1M", add_last_point=True)

I've also added add_last_point option to turn off last point marker for each line's end.

@soymsk soymsk force-pushed the add-style-for-timestamped-geojson branch from 64d5b9a to 2f56c36 Compare May 31, 2017 08:22
@soymsk soymsk force-pushed the add-style-for-timestamped-geojson branch from 2f56c36 to 32ac8fc Compare May 31, 2017 08:58
@@ -51,7 +51,10 @@ def test_timestamped_geo_json():
"properties": {
"times": [1435708800000+i*86400000 for
i in np.linspace(0, 25, 25)]
}
},
"style": {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E131 continuation line unaligned for hanging indent

@soymsk soymsk force-pushed the add-style-for-timestamped-geojson branch from 32ac8fc to 329661d Compare May 31, 2017 09:04
@ocefpaf
Copy link
Member

ocefpaf commented May 31, 2017

Thanks! LGTM. Just one request and one suggestion: can you add a changelog entry for this? And, if you if have some spare time, can you also add a notebook to the example directory? I am planning on running nbsphinx/gallery on that directory to improve the docs.

@soymsk
Copy link
Contributor Author

soymsk commented Jun 2, 2017

@ocefpaf Thanks for taking time to review my PR!
I've added changelog and an example in plugins notebook.

@ocefpaf
Copy link
Member

ocefpaf commented Jun 2, 2017

Thanks! Hope to see more PRs from you again 😉

@ocefpaf ocefpaf merged commit ba45248 into python-visualization:master Jun 2, 2017
sanga pushed a commit to sanga/folium that referenced this pull request Oct 24, 2017
…-timestamped-geojson

Add style for timestamped geojson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants