0
import numpy as np
lats = np.random.uniform(0, 90, 1_000_000) 
lons = np.random.uniform(0, 90, 1_000_000)      

import h3
import h3.api.numpy_int

Passing numpy arrays straight away:

fails with: TypeError: only size-1 arrays can be converted to Python scalars

h3.api.numpy_int.geo_to_h3(lats, lons, 6)

Following an example from their github issues:

fails with: AttributeError: module 'h3' has no attribute 'geo_to_h3_vect'

np.asarray(h3.geo_to_h3_vect(lats, lons, 10)) 

The version of h3 is: 3.7.6

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292

1 Answers1

1

It looks like:

from h3.unstable import vect

is needed for this. https://gist.github.com/ajfriend/3eccf3ec01b33f46dc14f5dbb13d8c6f

Georg Heiler
  • 16,916
  • 36
  • 162
  • 292