h3d 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- h3d-0.1.0/LICENSE +202 -0
- h3d-0.1.0/MANIFEST.in +4 -0
- h3d-0.1.0/NOTICE +7 -0
- h3d-0.1.0/PKG-INFO +104 -0
- h3d-0.1.0/README.md +79 -0
- h3d-0.1.0/docs/api/conversions.md +22 -0
- h3d-0.1.0/docs/api/hierarchy.md +22 -0
- h3d-0.1.0/docs/api/indexing.md +30 -0
- h3d-0.1.0/docs/api/inspection.md +30 -0
- h3d-0.1.0/docs/api/storage.md +24 -0
- h3d-0.1.0/docs/api/traversal.md +10 -0
- h3d-0.1.0/docs/api_quick.md +92 -0
- h3d-0.1.0/docs/api_reference.md +28 -0
- h3d-0.1.0/docs/concepts.md +25 -0
- h3d-0.1.0/docs/conf.py +28 -0
- h3d-0.1.0/docs/contributing.md +31 -0
- h3d-0.1.0/docs/documentation_guidelines.md +25 -0
- h3d-0.1.0/docs/format.md +45 -0
- h3d-0.1.0/docs/index.md +87 -0
- h3d-0.1.0/docs/usage.md +120 -0
- h3d-0.1.0/pyproject.toml +35 -0
- h3d-0.1.0/setup.cfg +4 -0
- h3d-0.1.0/src/h3d/__init__.py +58 -0
- h3d-0.1.0/src/h3d/_core.py +218 -0
- h3d-0.1.0/src/h3d/conversions.py +162 -0
- h3d-0.1.0/src/h3d/hierarchy.py +142 -0
- h3d-0.1.0/src/h3d/indexing.py +164 -0
- h3d-0.1.0/src/h3d/inspection.py +123 -0
- h3d-0.1.0/src/h3d/storage.py +46 -0
- h3d-0.1.0/src/h3d/traversal.py +64 -0
- h3d-0.1.0/src/h3d.egg-info/PKG-INFO +104 -0
- h3d-0.1.0/src/h3d.egg-info/SOURCES.txt +39 -0
- h3d-0.1.0/src/h3d.egg-info/dependency_links.txt +1 -0
- h3d-0.1.0/src/h3d.egg-info/requires.txt +9 -0
- h3d-0.1.0/src/h3d.egg-info/top_level.txt +1 -0
- h3d-0.1.0/tests/test_conversions.py +115 -0
- h3d-0.1.0/tests/test_core.py +90 -0
- h3d-0.1.0/tests/test_module_layout.py +15 -0
- h3d-0.1.0/tests/test_storage.py +63 -0
- h3d-0.1.0/tests/test_validation.py +140 -0
- h3d-0.1.0/tests/test_vertical.py +98 -0
h3d-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 Piglabs
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
h3d-0.1.0/MANIFEST.in
ADDED
h3d-0.1.0/NOTICE
ADDED
h3d-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: h3d
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: 3D Extension for Uber H3 Spatial Indexing
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Repository, https://github.com/piglabsai/h3d
|
|
7
|
+
Project-URL: Documentation, https://github.com/piglabsai/h3d/blob/main/docs/index.md
|
|
8
|
+
Project-URL: Issues, https://github.com/piglabsai/h3d/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/piglabsai/h3d/blob/main/CHANGELOG.md
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
13
|
+
Requires-Python: >=3.10
|
|
14
|
+
Description-Content-Type: text/markdown
|
|
15
|
+
License-File: LICENSE
|
|
16
|
+
License-File: NOTICE
|
|
17
|
+
Requires-Dist: h3<5,>=4.1
|
|
18
|
+
Provides-Extra: test
|
|
19
|
+
Requires-Dist: pytest>=8; extra == "test"
|
|
20
|
+
Provides-Extra: docs
|
|
21
|
+
Requires-Dist: sphinx<9,>=7.4; extra == "docs"
|
|
22
|
+
Requires-Dist: myst-parser<5,>=3; extra == "docs"
|
|
23
|
+
Requires-Dist: sphinx-book-theme<2,>=1.1; extra == "docs"
|
|
24
|
+
Dynamic: license-file
|
|
25
|
+
|
|
26
|
+
# H3D — 3D Extension for Uber H3 Spatial Indexing
|
|
27
|
+
|
|
28
|
+
**A voxel is a spatial region with an ID.** H3D extends an H3 cell through a
|
|
29
|
+
WGS84 ellipsoidal height interval. Use it to group positions by voxel, change
|
|
30
|
+
grid detail, or look up the original H3 footprint.
|
|
31
|
+
|
|
32
|
+
**Experimental preview.** Record the package version alongside persisted voxel
|
|
33
|
+
IDs while the API and index format are in early development.
|
|
34
|
+
|
|
35
|
+
## Install
|
|
36
|
+
|
|
37
|
+
Install with Python 3.10 or later. The H3 dependency is installed automatically.
|
|
38
|
+
|
|
39
|
+
```console
|
|
40
|
+
python -m pip install h3d
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
To install from a source checkout instead, run the following in its root.
|
|
44
|
+
|
|
45
|
+
```console
|
|
46
|
+
python -m pip install .
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## First example
|
|
50
|
+
|
|
51
|
+
Pass geodetic latitude and longitude in degrees and ellipsoidal height in metres. The representative coordinates combine the H3 grid center with the layer midpoint.
|
|
52
|
+
|
|
53
|
+
```pycon
|
|
54
|
+
>>> import h3d
|
|
55
|
+
>>> voxel = h3d.latlngalt_to_voxel(52.52, 13.405, 75.0, 9, 8)
|
|
56
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(voxel)
|
|
57
|
+
>>> lower <= 75.0 < upper
|
|
58
|
+
True
|
|
59
|
+
>>> h3d.get_surface_resolution(voxel), h3d.get_vertical_resolution(voxel)
|
|
60
|
+
(9, 8)
|
|
61
|
+
>>> h3d.voxel_to_h3(voxel) == voxel & ((1 << 64) - 1)
|
|
62
|
+
True
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Conversion functions
|
|
67
|
+
|
|
68
|
+
The conversion functions accept Earth-centered, Earth-fixed (ECEF) Cartesian coordinates in metres. This example indexes an illustrative position on the ECEF equatorial X axis about 400 km above the ellipsoid.
|
|
69
|
+
|
|
70
|
+
```pycon
|
|
71
|
+
>>> satellite = h3d.ecef_to_voxel(6_778_137.0, 0.0, 0.0, 5, 4)
|
|
72
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(satellite)
|
|
73
|
+
>>> lower <= 400_000.0 < upper
|
|
74
|
+
True
|
|
75
|
+
>>> x, y, z = h3d.voxel_to_ecef(satellite)
|
|
76
|
+
>>> h3d.ecef_to_voxel(x, y, z, 5, 4) == satellite
|
|
77
|
+
True
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The satellite input must already be in WGS84 ECEF. Positions in an inertial frame require a frame transformation using the observation time before indexing.
|
|
82
|
+
|
|
83
|
+
## What to know
|
|
84
|
+
|
|
85
|
+
- Geodetic inputs use degrees and WGS84 ellipsoidal height in metres. The
|
|
86
|
+
indexing domain extends from about 1,110 km below the ellipsoid to 567,006 km
|
|
87
|
+
above it, with an exclusive upper bound.
|
|
88
|
+
- `surface_resolution` selects horizontal detail (0–15).
|
|
89
|
+
`vertical_resolution` selects layer thickness (0–10), with approximately
|
|
90
|
+
7.856 mm thickness at level 10.
|
|
91
|
+
- Voxel IDs are 128-bit Python integers. Use 32 lowercase hexadecimal digits
|
|
92
|
+
for text interchange and `voxel_to_h3()` to recover the original H3 cell.
|
|
93
|
+
|
|
94
|
+
## Documentation
|
|
95
|
+
|
|
96
|
+
- [Documentation home](https://github.com/piglabsai/h3d/blob/main/docs/index.md)
|
|
97
|
+
- [Understand the grid](https://github.com/piglabsai/h3d/blob/main/docs/concepts.md)
|
|
98
|
+
- [Usage guide](https://github.com/piglabsai/h3d/blob/main/docs/usage.md)
|
|
99
|
+
- [API quick reference](https://github.com/piglabsai/h3d/blob/main/docs/api_quick.md)
|
|
100
|
+
- [API reference](https://github.com/piglabsai/h3d/blob/main/docs/api_reference.md)
|
|
101
|
+
- [Format specification](https://github.com/piglabsai/h3d/blob/main/docs/format.md)
|
|
102
|
+
- [Contributor guide](https://github.com/piglabsai/h3d/blob/main/docs/contributing.md)
|
|
103
|
+
|
|
104
|
+
H3D is licensed under [Apache-2.0](https://github.com/piglabsai/h3d/blob/main/LICENSE).
|
h3d-0.1.0/README.md
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# H3D — 3D Extension for Uber H3 Spatial Indexing
|
|
2
|
+
|
|
3
|
+
**A voxel is a spatial region with an ID.** H3D extends an H3 cell through a
|
|
4
|
+
WGS84 ellipsoidal height interval. Use it to group positions by voxel, change
|
|
5
|
+
grid detail, or look up the original H3 footprint.
|
|
6
|
+
|
|
7
|
+
**Experimental preview.** Record the package version alongside persisted voxel
|
|
8
|
+
IDs while the API and index format are in early development.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
Install with Python 3.10 or later. The H3 dependency is installed automatically.
|
|
13
|
+
|
|
14
|
+
```console
|
|
15
|
+
python -m pip install h3d
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
To install from a source checkout instead, run the following in its root.
|
|
19
|
+
|
|
20
|
+
```console
|
|
21
|
+
python -m pip install .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## First example
|
|
25
|
+
|
|
26
|
+
Pass geodetic latitude and longitude in degrees and ellipsoidal height in metres. The representative coordinates combine the H3 grid center with the layer midpoint.
|
|
27
|
+
|
|
28
|
+
```pycon
|
|
29
|
+
>>> import h3d
|
|
30
|
+
>>> voxel = h3d.latlngalt_to_voxel(52.52, 13.405, 75.0, 9, 8)
|
|
31
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(voxel)
|
|
32
|
+
>>> lower <= 75.0 < upper
|
|
33
|
+
True
|
|
34
|
+
>>> h3d.get_surface_resolution(voxel), h3d.get_vertical_resolution(voxel)
|
|
35
|
+
(9, 8)
|
|
36
|
+
>>> h3d.voxel_to_h3(voxel) == voxel & ((1 << 64) - 1)
|
|
37
|
+
True
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Conversion functions
|
|
42
|
+
|
|
43
|
+
The conversion functions accept Earth-centered, Earth-fixed (ECEF) Cartesian coordinates in metres. This example indexes an illustrative position on the ECEF equatorial X axis about 400 km above the ellipsoid.
|
|
44
|
+
|
|
45
|
+
```pycon
|
|
46
|
+
>>> satellite = h3d.ecef_to_voxel(6_778_137.0, 0.0, 0.0, 5, 4)
|
|
47
|
+
>>> lower, upper = h3d.voxel_altitude_bounds(satellite)
|
|
48
|
+
>>> lower <= 400_000.0 < upper
|
|
49
|
+
True
|
|
50
|
+
>>> x, y, z = h3d.voxel_to_ecef(satellite)
|
|
51
|
+
>>> h3d.ecef_to_voxel(x, y, z, 5, 4) == satellite
|
|
52
|
+
True
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
The satellite input must already be in WGS84 ECEF. Positions in an inertial frame require a frame transformation using the observation time before indexing.
|
|
57
|
+
|
|
58
|
+
## What to know
|
|
59
|
+
|
|
60
|
+
- Geodetic inputs use degrees and WGS84 ellipsoidal height in metres. The
|
|
61
|
+
indexing domain extends from about 1,110 km below the ellipsoid to 567,006 km
|
|
62
|
+
above it, with an exclusive upper bound.
|
|
63
|
+
- `surface_resolution` selects horizontal detail (0–15).
|
|
64
|
+
`vertical_resolution` selects layer thickness (0–10), with approximately
|
|
65
|
+
7.856 mm thickness at level 10.
|
|
66
|
+
- Voxel IDs are 128-bit Python integers. Use 32 lowercase hexadecimal digits
|
|
67
|
+
for text interchange and `voxel_to_h3()` to recover the original H3 cell.
|
|
68
|
+
|
|
69
|
+
## Documentation
|
|
70
|
+
|
|
71
|
+
- [Documentation home](https://github.com/piglabsai/h3d/blob/main/docs/index.md)
|
|
72
|
+
- [Understand the grid](https://github.com/piglabsai/h3d/blob/main/docs/concepts.md)
|
|
73
|
+
- [Usage guide](https://github.com/piglabsai/h3d/blob/main/docs/usage.md)
|
|
74
|
+
- [API quick reference](https://github.com/piglabsai/h3d/blob/main/docs/api_quick.md)
|
|
75
|
+
- [API reference](https://github.com/piglabsai/h3d/blob/main/docs/api_reference.md)
|
|
76
|
+
- [Format specification](https://github.com/piglabsai/h3d/blob/main/docs/format.md)
|
|
77
|
+
- [Contributor guide](https://github.com/piglabsai/h3d/blob/main/docs/contributing.md)
|
|
78
|
+
|
|
79
|
+
H3D is licensed under [Apache-2.0](https://github.com/piglabsai/h3d/blob/main/LICENSE).
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Conversion functions
|
|
2
|
+
|
|
3
|
+
Convert between WGS84 geodetic and ECEF coordinates, or index ECEF points directly.
|
|
4
|
+
|
|
5
|
+
These functions are defined in `h3d.conversions` and also available from `h3d`.
|
|
6
|
+
See [API conventions](../api_reference.md) for units and validation rules.
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: h3d.geodetic_to_ecef
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```{eval-rst}
|
|
13
|
+
.. autofunction:: h3d.ecef_to_geodetic
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. autofunction:: h3d.ecef_to_voxel
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```{eval-rst}
|
|
21
|
+
.. autofunction:: h3d.voxel_to_ecef
|
|
22
|
+
```
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Hierarchy
|
|
2
|
+
|
|
3
|
+
Change the surface resolution, vertical resolution, or both.
|
|
4
|
+
|
|
5
|
+
These functions are defined in `h3d.hierarchy` and also available from `h3d`.
|
|
6
|
+
See [API conventions](../api_reference.md) for units and validation rules.
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: h3d.vertical_to_parent
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```{eval-rst}
|
|
13
|
+
.. autofunction:: h3d.vertical_to_children
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. autofunction:: h3d.voxel_to_parent
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```{eval-rst}
|
|
21
|
+
.. autofunction:: h3d.voxel_to_children
|
|
22
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Indexing
|
|
2
|
+
|
|
3
|
+
Encode geodetic positions, decode voxel representatives, and work with vertical intervals.
|
|
4
|
+
|
|
5
|
+
These functions are defined in `h3d.indexing` and also available from `h3d`.
|
|
6
|
+
See [API conventions](../api_reference.md) for units and validation rules.
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: h3d.latlngalt_to_voxel
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```{eval-rst}
|
|
13
|
+
.. autofunction:: h3d.voxel_to_latlngalt
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. autofunction:: h3d.altitude_to_vertical
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```{eval-rst}
|
|
21
|
+
.. autofunction:: h3d.vertical_to_altitude
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```{eval-rst}
|
|
25
|
+
.. autofunction:: h3d.vertical_bounds
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```{eval-rst}
|
|
29
|
+
.. autofunction:: h3d.voxel_altitude_bounds
|
|
30
|
+
```
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Inspection
|
|
2
|
+
|
|
3
|
+
Validate voxel IDs, inspect their resolutions, and read or combine their component words.
|
|
4
|
+
|
|
5
|
+
These functions are defined in `h3d.inspection` and also available from `h3d`.
|
|
6
|
+
See [API conventions](../api_reference.md) for units and validation rules.
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: h3d.is_valid_voxel
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```{eval-rst}
|
|
13
|
+
.. autofunction:: h3d.get_surface_resolution
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
```{eval-rst}
|
|
17
|
+
.. autofunction:: h3d.get_vertical_resolution
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```{eval-rst}
|
|
21
|
+
.. autofunction:: h3d.voxel_to_h3
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
```{eval-rst}
|
|
25
|
+
.. autofunction:: h3d.voxel_to_vertical
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
```{eval-rst}
|
|
29
|
+
.. autofunction:: h3d.h3_to_voxel
|
|
30
|
+
```
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Storage
|
|
2
|
+
|
|
3
|
+
Split and restore voxel IDs using two unsigned 64-bit integer columns.
|
|
4
|
+
These functions are available from `h3d.storage` and from `h3d`.
|
|
5
|
+
|
|
6
|
+
For schemas and a round-trip example, see
|
|
7
|
+
[Store voxels in DuckDB and Parquet](../usage.md#store-voxels-in-duckdb-and-parquet).
|
|
8
|
+
|
|
9
|
+
For storage within DuckDB, a single signed `HUGEINT` column can hold any H3D
|
|
10
|
+
version-1 voxel ID exactly because the zero top bit keeps the ID within the
|
|
11
|
+
signed 128-bit integer range. A direct Parquet export in DuckDB 2.0.1 writes
|
|
12
|
+
`HUGEINT` as `DOUBLE`. Its 53 bits of significand precision can round away
|
|
13
|
+
the low bits of the voxel ID. Use two `UBIGINT` columns for an exact Parquet
|
|
14
|
+
round trip.
|
|
15
|
+
[DuckDB numeric types](https://duckdb.org/docs/current/sql/data_types/numeric) ·
|
|
16
|
+
[Binary64 precision](https://docs.python.org/3/tutorial/floatingpoint.html#representation-error)
|
|
17
|
+
|
|
18
|
+
```{eval-rst}
|
|
19
|
+
.. autofunction:: h3d.voxel_to_parts
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
```{eval-rst}
|
|
23
|
+
.. autofunction:: h3d.parts_to_voxel
|
|
24
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Traversal
|
|
2
|
+
|
|
3
|
+
Find vertical layers intersecting an altitude range.
|
|
4
|
+
|
|
5
|
+
These functions are defined in `h3d.traversal` and also available from `h3d`.
|
|
6
|
+
See [API conventions](../api_reference.md) for units and validation rules.
|
|
7
|
+
|
|
8
|
+
```{eval-rst}
|
|
9
|
+
.. autofunction:: h3d.iter_vertical_range
|
|
10
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# API quick reference
|
|
2
|
+
|
|
3
|
+
Functions are grouped by task. Follow a function link for its complete API contract.
|
|
4
|
+
|
|
5
|
+
## Indexing
|
|
6
|
+
|
|
7
|
+
Encode geodetic positions, decode voxel representatives, and work with vertical intervals.
|
|
8
|
+
|
|
9
|
+
```{eval-rst}
|
|
10
|
+
.. currentmodule:: h3d
|
|
11
|
+
|
|
12
|
+
.. autosummary::
|
|
13
|
+
|
|
14
|
+
latlngalt_to_voxel
|
|
15
|
+
voxel_to_latlngalt
|
|
16
|
+
altitude_to_vertical
|
|
17
|
+
vertical_to_altitude
|
|
18
|
+
vertical_bounds
|
|
19
|
+
voxel_altitude_bounds
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Inspection
|
|
23
|
+
|
|
24
|
+
Validate voxel IDs, inspect their resolutions, and read or combine their component words.
|
|
25
|
+
|
|
26
|
+
```{eval-rst}
|
|
27
|
+
.. currentmodule:: h3d
|
|
28
|
+
|
|
29
|
+
.. autosummary::
|
|
30
|
+
|
|
31
|
+
is_valid_voxel
|
|
32
|
+
get_surface_resolution
|
|
33
|
+
get_vertical_resolution
|
|
34
|
+
voxel_to_h3
|
|
35
|
+
voxel_to_vertical
|
|
36
|
+
h3_to_voxel
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Traversal
|
|
40
|
+
|
|
41
|
+
Find vertical layers intersecting an altitude range.
|
|
42
|
+
|
|
43
|
+
```{eval-rst}
|
|
44
|
+
.. currentmodule:: h3d
|
|
45
|
+
|
|
46
|
+
.. autosummary::
|
|
47
|
+
|
|
48
|
+
iter_vertical_range
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Hierarchy
|
|
52
|
+
|
|
53
|
+
Change the surface resolution, vertical resolution, or both.
|
|
54
|
+
|
|
55
|
+
```{eval-rst}
|
|
56
|
+
.. currentmodule:: h3d
|
|
57
|
+
|
|
58
|
+
.. autosummary::
|
|
59
|
+
|
|
60
|
+
vertical_to_parent
|
|
61
|
+
vertical_to_children
|
|
62
|
+
voxel_to_parent
|
|
63
|
+
voxel_to_children
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Conversion functions
|
|
67
|
+
|
|
68
|
+
Convert between WGS84 geodetic and ECEF coordinates, or index ECEF points directly.
|
|
69
|
+
|
|
70
|
+
```{eval-rst}
|
|
71
|
+
.. currentmodule:: h3d
|
|
72
|
+
|
|
73
|
+
.. autosummary::
|
|
74
|
+
|
|
75
|
+
geodetic_to_ecef
|
|
76
|
+
ecef_to_geodetic
|
|
77
|
+
ecef_to_voxel
|
|
78
|
+
voxel_to_ecef
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Storage
|
|
82
|
+
|
|
83
|
+
Split a voxel into two unsigned 64-bit words or restore it from those words.
|
|
84
|
+
|
|
85
|
+
```{eval-rst}
|
|
86
|
+
.. currentmodule:: h3d
|
|
87
|
+
|
|
88
|
+
.. autosummary::
|
|
89
|
+
|
|
90
|
+
voxel_to_parts
|
|
91
|
+
parts_to_voxel
|
|
92
|
+
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# API reference
|
|
2
|
+
|
|
3
|
+
Import public functions from `h3d` or from the category modules listed below.
|
|
4
|
+
The [quick reference](api_quick.md) links directly to each function. See the
|
|
5
|
+
[usage guide](usage.md) for runnable examples.
|
|
6
|
+
|
|
7
|
+
Geodetic coordinates use latitude and longitude in degrees followed by
|
|
8
|
+
ellipsoidal height in metres. Earth-centered, Earth-fixed coordinates use
|
|
9
|
+
`(x, y, z)` in metres. Surface resolution is 0–15 and vertical resolution is
|
|
10
|
+
0–10.
|
|
11
|
+
|
|
12
|
+
Indexes and resolutions accept integral values and reject booleans. Coordinates
|
|
13
|
+
accept real numbers that convert to finite binary64 values and reject
|
|
14
|
+
booleans. Functions raise `TypeError` for unsupported types and `ValueError`
|
|
15
|
+
for invalid values. `is_valid_voxel()` returns `False` for invalid IDs.
|
|
16
|
+
Lazy functions validate arguments at call time and return single-pass
|
|
17
|
+
iterators.
|
|
18
|
+
|
|
19
|
+
```{toctree}
|
|
20
|
+
:maxdepth: 1
|
|
21
|
+
|
|
22
|
+
api/indexing
|
|
23
|
+
api/inspection
|
|
24
|
+
api/traversal
|
|
25
|
+
api/hierarchy
|
|
26
|
+
api/conversions
|
|
27
|
+
api/storage
|
|
28
|
+
```
|