Creates a geojson of hexagonal features based on the outputs of _compute_wgs84_hexbin
(hexagons_lats, hexagons_lons, ids=None)
| 303 | |
| 304 | |
| 305 | def _hexagons_to_geojson(hexagons_lats, hexagons_lons, ids=None): |
| 306 | """ |
| 307 | Creates a geojson of hexagonal features based on the outputs of |
| 308 | _compute_wgs84_hexbin |
| 309 | """ |
| 310 | features = [] |
| 311 | if ids is None: |
| 312 | ids = np.arange(len(hexagons_lats)) |
| 313 | for lat, lon, idx in zip(hexagons_lats, hexagons_lons, ids): |
| 314 | points = np.array([lon, lat]).T.tolist() |
| 315 | points.append(points[0]) |
| 316 | features.append( |
| 317 | dict( |
| 318 | type="Feature", |
| 319 | id=idx, |
| 320 | geometry=dict(type="Polygon", coordinates=[points]), |
| 321 | ) |
| 322 | ) |
| 323 | return dict(type="FeatureCollection", features=features) |
| 324 | |
| 325 | |
| 326 | def create_hexbin_map( |
no test coverage detected