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 shape of 'Antarctica' in 'naturalearth_lowres' dataset #804

Closed
iliatimofeev opened this issue Aug 21, 2018 · 5 comments
Closed

Wrong shape of 'Antarctica' in 'naturalearth_lowres' dataset #804

iliatimofeev opened this issue Aug 21, 2018 · 5 comments
Milestone

Comments

@iliatimofeev
Copy link

iliatimofeev commented Aug 21, 2018

import geopandas as gpd

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world[world.continent=='Antarctica'].difference(sh.geometry.box(-180,-90,180,90)).__geo_interface__

Will result:

{'type': 'FeatureCollection',
 'features': [{'id': '6',
   'type': 'Feature',
   'properties': {},
   'geometry': {'type': 'Polygon',
    'coordinates': (((180.0, -84.71337999999997),
      (180.00000000000014, -84.71337999999999),
      (180.00000000000014, -90.00000000000003),  <--- this is not valid coordinates 
      (-179.99999999999997, -90.00000000000003), 
      (-179.99999999999997, -90.0),
      (180.0, -90.0),
      (180.0, -84.71337999999997)),)},
   'bbox': (-179.99999999999997,
    -90.00000000000003,
    180.00000000000014,
    -84.71337999999997)}],
 'bbox': (-179.99999999999997,
  -90.00000000000003,
  180.00000000000014,
  -84.71337999999997)}

original issue: iliatimofeev/gpdvega#1

@jorisvandenbossche
Copy link
Member

About gpdvega: that looks like a nice package! Something I need to check out


Do you have the same issue if you download the latest version directly from naturalearth.com: http://www.naturalearthdata.com/downloads/110m-cultural-vectors/110m-admin-0-countries/ ?

I am wondering if this is not just a floating point precision issue (what still is annoying of course, but not necessarily an "error" in the data)

A bit simpler example (without the difference and conversion to geojson):

In [16]: import geopandas

In [18]: df = geopandas.read_file(geopandas.datasets.get_path('naturalearth_lowres'))

In [19]: df[df.name == 'Antarctica']
Out[19]: 
   pop_est   continent        name iso_a3  gdp_md_est                                           geometry
6   3802.0  Antarctica  Antarctica    ATA       760.4  (POLYGON ((-59.57209469261153 -80.040178725096...

In [21]: antarctica = df[df.name == 'Antarctica'].geometry.squeeze()

In [24]: antarctica.bounds
Out[24]: 
(-179.99999999999997,
 -90.00000000000003,
 180.00000000000014,
 -63.27066048950458)

@jorisvandenbossche
Copy link
Member

So I don't seem to have it with the latest version:

In [27]: df = geopandas.read_file("zip://../Downloads/ne_110m_admin_0_countries.zip")

In [33]: antarctica = df[df.NAME == 'Antarctica'].geometry.squeeze()

In [34]: antarctica
Out[34]: <shapely.geometry.multipolygon.MultiPolygon at 0x7f9a8aea2550>

In [35]: antarctica.bounds
Out[35]: (-179.99999999999994, -90.0, 180.0, -63.27066048950462)

Can you test if the plotting issues are also solved when using that version?

@iliatimofeev
Copy link
Author

Yes. It helps. :)

visualization 45

Would you update demo dataset?

@jorisvandenbossche jorisvandenbossche added this to the 0.5 milestone Aug 24, 2018
@jorisvandenbossche
Copy link
Member

Would you update demo dataset?

Yes, that seems to be a good idea. I might not get directly to it (but I will tag it for the next release, so it certainly gets done), so a PR is certainly welcome as well!

@jdmcbr
Copy link
Member

jdmcbr commented Jan 2, 2019

Closed by #808

@jdmcbr jdmcbr closed this as completed Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants