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

wrong 'Antarctica' #1

Open
iliatimofeev opened this issue Aug 15, 2018 · 1 comment
Open

wrong 'Antarctica' #1

iliatimofeev opened this issue Aug 15, 2018 · 1 comment
Labels
geopandas geopandas-related issue vega vega-related issue

Comments

@iliatimofeev
Copy link
Owner

import altair as alt
import geopandas as gpd
import gpdvega 

alt.renderers.enable('notebook') # render for Jupyter Notebook

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

# GeoDataFrame could be passed as usual pd.DataFrame 
alt.Chart(world[world.continent=='Antarctica']).mark_geoshape(
    stroke='#1f77b4',  
    fill='#7f7f7f',
    fillOpacity=0.3
).project(
).encode( 
).properties( 
    width=500,
    height=300
)

visualization 39
but

world[world.continent=='Antarctica'].plot()

image

@iliatimofeev iliatimofeev added vega vega-related issue geopandas geopandas-related issue labels Aug 21, 2018
@iliatimofeev
Copy link
Owner Author

iliatimofeev commented Aug 21, 2018

It's both sides issue. Geopandas Antarctica contains point (180.00000000000014, -90.00000000000003) which is not valid. And Vega do not interpret it as expected.

So current workaround is to cut Antarctica with correct box.

import altair as alt
import geopandas as gpd
import gpdvega 

alt.renderers.enable('notebook') # render for Jupyter Notebook

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))

#workaround
world.set_geometry( world.geometry.intersection(sh.geometry.box(-180,-90,180,90)),inplace=True)


alt.Chart(world).mark_geoshape(
    stroke='#1f77b4',  
    fill='#7f7f7f',
    fillOpacity=0.3

).project(
).encode( 
).properties( 
    width=500,
    height=300
)

visualization 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
geopandas geopandas-related issue vega vega-related issue
Projects
None yet
Development

No branches or pull requests

1 participant