H3-Pandas icon indicating copy to clipboard operation
H3-Pandas copied to clipboard

H3 geometries are broken when crossing the antimeridian

Open MathewBiddle opened this issue 1 year ago • 0 comments

I've been testing with a global dataset and when generating cells that cross the antimeridian the polygons get all messed up. Not sure if it's an issue with the H3 package or the plotting routines.

https://gist.github.com/MathewBiddle/4e095360e16b5c8674766afe47856bb4

import random
import pandas as pd
import h3pandas

df = pd.DataFrame()

stepsize = 0.001
for x in range(-180, 180, 10):
    for y in range(-90, 90, 10):
        df = pd.concat([df , pd.DataFrame({'lng':[x],'lat':[y],'value':random.randint(1, 10)})])
#        yield (x, y)

df.h3.geo_to_h3(0).h3.h3_to_geo_boundary().plot(column='value')

Image

Similarly if I stick it into a geodataframe and .explore():

Image

MathewBiddle avatar Feb 26 '25 20:02 MathewBiddle