Skip to content
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

TimestampedGeoJson does not plot entire image #1235

Closed
samirak93 opened this issue Dec 5, 2019 · 5 comments
Closed

TimestampedGeoJson does not plot entire image #1235

samirak93 opened this issue Dec 5, 2019 · 5 comments

Comments

@samirak93
Copy link

I'm trying to make a TimestampedGeoJson using a geojson file. I've previously done that and the output was correct. Now when I try with a different data, the plot is not complete.

This is an example where it worked fine (this was done long back). https://github.com/samirak93/snow/blob/master/Complete_Notebook.ipynb

This is the example I'm trying to plot now.

import urllib.request, json 
import urllib.request, json 
from folium.plugins import TimestampedGeoJson
import folium
from folium import plugins

with urllib.request.urlopen("https://gist.githubusercontent.com/samirak93/3ca0672e89677c248cb4853e374a02ac/raw/5c46cfdcefc4aca2e459ddd60f99a9e21db1843f/myfile.geojson") as url:
    data = json.loads(url.read().decode())
    
geomap = folium.Map(location=[51.4919263,-0.1867], zoom_start=10, tiles="cartodbpositron")

TimestampedGeoJson(
    data,
    auto_play=False,
    date_options='YYY'
    ).add_to(geomap)

plugins.Fullscreen(position='topright', force_separate_button=True).add_to(geomap)
geomap

The plot when plotted with Matplotlib's Contourf
image

The image when plotted on folium:

image

Python version: 3.7.5
Folium version: 0.10.1

Any feedback would be helpful.

Thanks.

@Conengmo
Copy link
Member

Conengmo commented Dec 5, 2019

Could you look in your browser's console and share any error messages that might be there?

@samirak93
Copy link
Author

This is the output on the chrome console.

image

Checked with firefox as well and could not see the output.

@Conengmo
Copy link
Member

Conengmo commented Dec 5, 2019

One more thing, could you try to export the map as an html file, and open that in your browser? That way we know whether the issue has to do with Jupyter or not.

m.save('index.html')

@samirak93
Copy link
Author

I see a bunch of warning's on Firefox but none on Chrome/Safari. There are no errors as well.

image

I've uploaded the html file here https://gist.github.com/samirak93/6b2d0f6b9fad93f8c248a8b418926ba1#file-geojson-html

Thank you.

@Conengmo
Copy link
Member

Conengmo commented Dec 5, 2019

It seems your input data is incorrect. It seem each geojson feature has the same property "time": "2287-01-31". But the plugin requires each feature to have a property times, which should be list containing either unix epoch timestamps in ms or ISO format timestamps. See https://python-visualization.github.io/folium/plugins.html#folium.plugins.TimestampedGeoJson

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

No branches or pull requests

2 participants