Cover requests#
This tutorial explains how to find all the HEALPix cells which intersect a geographic region.
Type of requests#
1. Cone Coverage#
Find all cells within a given radius around a point.
import numpy as np
from healpix_geo.nested import cone_coverage
# Center and radius
lon_center = 2.3522 # Paris
lat_center = 48.8566
radius_deg = 1.0 # radius in degrees (~111 km)
depth = 8
cells = cone_coverage((lon_center, lat_center), radius_deg, depth, ellipsoid="WGS84")
print(f"Number of cells in the radius: {len(cells)}")
Number of cells in the radius: 3
2. Box Coverage#
Find all cells in a spherical rectangle.
from healpix_geo.nested import box_coverage
# Coverage box
lon_min, lat_min = 2.0, 48.5
lon_max, lat_max = 3.0, 49.0
center = (
0.5 * (lon_min + lon_max),
0.5 * (lat_min + lat_max),
)
size = (
lon_max - lon_min,
lat_max - lat_min,
)
angle = 0.0
depth = 8
cells = box_coverage(center, size, angle, depth, ellipsoid="WGS84", flat=True)
print(f"Cells number : {len(cells)}")
Cells number : 3
3. Polygon coverage#
Find all cells in a polygon coverage.
from healpix_geo.nested import polygon_coverage
import numpy as np
vertices = np.array([[2.0, 48.5], [3.0, 48.5], [2.5, 49.0]])
depth = 8
cells = polygon_coverage(vertices, depth, ellipsoid="WGS84", flat=True)
print(f"Cells in the polygon : {len(cells)}")
Cells in the polygon : 3
Summary#
Principal functions working on geometries#
Function |
Usage |
Key parameters |
|---|---|---|
|
Zone request |
bbox, depth |
|
Circular request |
center, radius, depth |
|
Rectangular request |
center, size, angle, depth |
|
Elliptical cone request |
center, ellipse_geometry, position_angle, depth |
|
Polygonal request |
vertices, depth |
Principal functions working on a region represented by cells#
Function |
Usage |
Key parameters |
|---|---|---|
|
Boundaries |
depth, ipix |
Next Steps#
Working MOC
Performance
Hierarchy
Api reference