DGGS Generator
Generator module for vgrid.
This module provides functions to generate discrete global grid systems (DGGS) for various coordinate systems and geographic areas.
a5grid_cli()
¶
CLI interface for generating A5 DGGS.
Source code in vgrid/generator/a5grid.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
digipingrid_cli()
¶
Command-line interface for DIGIPIN grid generation.
Source code in vgrid/generator/digipingrid.py
271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | |
h3grid_cli()
¶
CLI interface for generating H3 grid.
Source code in vgrid/generator/h3grid.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
rhealpixgrid_cli()
¶
CLI interface for generating rHEALPix grid.
Source code in vgrid/generator/rhealpixgrid.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
s2grid_cli()
¶
CLI interface for generating S2 grid.
Source code in vgrid/generator/s2grid.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
h3_grid_ids(resolution, fix_antimeridian=None)
¶
Generate a list of H3 cell IDs for the whole world at a given resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
H3 resolution [0..15] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of H3 cell IDs as strings |
Source code in vgrid/generator/h3grid.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
h3_grid_within_bbox_ids(resolution, bbox, fix_antimeridian=None)
¶
Generate a list of H3 cell IDs that intersect a bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
H3 resolution [0..15] |
required |
bbox
|
list[float]
|
[min_lon, min_lat, max_lon, max_lat] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of H3 cell IDs as strings that intersect the bbox |
Source code in vgrid/generator/h3grid.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
h3grid(resolution, bbox=None, output_format='gpd', fix_antimeridian=None)
¶
Generate H3 grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
H3 resolution [0..15] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format handled entirely by convert_to_output_format |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
Delegated to convert_to_output_format |
Source code in vgrid/generator/h3grid.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
h3grid_cli()
¶
CLI interface for generating H3 grid.
Source code in vgrid/generator/h3grid.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | |
S2 Grid Generator Module
Generates S2 DGGS grids for specified resolutions and bounding boxes with automatic cell generation and validation.
Key Functions: - s2_grid(): Main grid generation function with bounding box support - s2_grid_ids(): Returns list of S2 cell tokens for given resolution and bbox - s2grid(): User-facing function with multiple output formats - s2grid_cli(): Command-line interface for grid generation
Reference
s2_grid(resolution, bbox, fix_antimeridian=None)
¶
Generate an S2 DGGS grid for a given resolution and bounding box. fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Args: resolution (int): S2 level [0..30] bbox (list[float]): [min_lon, min_lat, max_lon, max_lat] fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Returns: geopandas.GeoDataFrame: GeoDataFrame containing the S2 DGGS grid
Source code in vgrid/generator/s2grid.py
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
s2_grid_ids(resolution, bbox, fix_antimeridian=None)
¶
Return a list of S2 cell tokens for a given resolution and bounding box. fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Args: resolution (int): S2 level [0..30] bbox (list[float]): [min_lon, min_lat, max_lon, max_lat] fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Returns: list[str]: List of S2 cell tokens
Source code in vgrid/generator/s2grid.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
s2_grid_resample(resolution, geojson_features, fix_antimeridian=None)
¶
Generate an S2 DGGS grid for a given resolution and GeoJSON features. fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Args: resolution (int): S2 level [0..30] geojson_features (dict): GeoJSON features fix_antimeridian : Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Returns: geopandas.GeoDataFrame: GeoDataFrame containing the S2 DGGS grid
Source code in vgrid/generator/s2grid.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | |
s2grid(resolution, bbox=None, output_format='gpd', fix_antimeridian=None)
¶
Generate S2 grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
S2 resolution [0..30] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output output_format ('geojson', 'csv', etc.). Defaults to None (list of S2 tokens). |
'gpd'
|
fix_antimeridian
|
str
|
Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none. Defaults to None. |
None
|
Source code in vgrid/generator/s2grid.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
s2grid_cli()
¶
CLI interface for generating S2 grid.
Source code in vgrid/generator/s2grid.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
A5 Grid Generator Module
Generates A5 (Adaptive 5) DGGS grids for specified resolutions and bounding boxes with automatic cell generation and validation.
Key Functions: - a5_grid(): Main grid generation function with bounding box support - a5grid(): User-facing function with multiple output formats - a5grid_cli(): Command-line interface for grid generation
a5_grid_ids(resolution, bbox)
¶
Generate a list of unique A5 cell IDs intersecting the given bounding box.
Note: Intentionally does not enforce MAX_CELLS limit for ID generation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
A5 resolution [0..29] |
required |
bbox
|
list
|
[min_lon, min_lat, max_lon, max_lat] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of A5 cell IDs |
Source code in vgrid/generator/a5grid.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 | |
a5grid(resolution, bbox=None, output_format='gpd', options=None, split_antimeridian=False)
¶
Generate A5 grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
A5 resolution [0..30] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format (gpd, gdf, geojson_dict/json_dict, geojson/json, csv, shp/shapefile, gpkg/geopackage, parquet/geoparquet, or None) |
'gpd'
|
options
|
dict
|
Options for a52geo. |
None
|
split_antimeridian
|
bool
|
When True, apply antimeridian fixing to the resulting polygons. |
False
|
Source code in vgrid/generator/a5grid.py
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 | |
a5grid_cli()
¶
CLI interface for generating A5 DGGS.
Source code in vgrid/generator/a5grid.py
227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | |
rHEALPix Grid Generator Module
Generates rHEALPix DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical equal-area grid system.
Key Functions: - rhealpix_grid(): Main grid generation function for whole world - rhealpix_grid_within_bbox(): Grid generation within bounding box - rhealpixgrid(): User-facing function with multiple output formats - rhealpixgrid_cli(): Command-line interface for grid generation
rhealpix_grid_ids(resolution)
¶
Return a list of rHEALPix cell IDs for the whole world at a given resolution.
Source code in vgrid/generator/rhealpixgrid.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
rhealpix_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of rHEALPix cell IDs intersecting the given bounding box at a given resolution.
Source code in vgrid/generator/rhealpixgrid.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
rhealpixgrid(resolution, bbox=None, output_format='gpd', fix_antimeridian=None)
¶
Generate rHEALPix grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
rHEALPix resolution [0..15] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output output_format ('geojson', 'csv', 'geo', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of rHEALPix IDs). Defaults to None. |
'gpd'
|
fix_antimeridian (Antimeridian fixing method
|
shift, shift_balanced, shift_west, shift_east, split, none, optional): When True, apply antimeridian fixing to the resulting polygons. Defaults to False when None or omitted. |
required |
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output in the requested output_format (GeoJSON FeatureCollection, list of IDs, file path, etc.) |
Source code in vgrid/generator/rhealpixgrid.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |
rhealpixgrid_cli()
¶
CLI interface for generating rHEALPix grid.
Source code in vgrid/generator/rhealpixgrid.py
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
ISEA4T Grid Generator Module
Generates ISEA4T DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical triangular grid system.
Key Functions: - isea4t_grid(): Main grid generation function for whole world - isea4t_grid_within_bbox(): Grid generation within bounding box - isea4tgrid(): User-facing function with multiple output formats - isea4tgrid_cli(): Command-line interface for grid generation
get_isea4t_children_cells(base_cells, target_resolution)
¶
Recursively generate DGGS cells for the desired resolution.
Source code in vgrid/generator/isea4tgrid.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
isea4t_grid_ids(resolution)
¶
Return a list of ISEA4T cell IDs for the whole world at a given resolution.
Source code in vgrid/generator/isea4tgrid.py
123 124 125 126 127 128 129 | |
isea4t_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of ISEA4T cell IDs intersecting the given bounding box at a given resolution.
Source code in vgrid/generator/isea4tgrid.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
isea4tgrid(resolution, bbox=None, output_format='gpd', fix_antimeridian=None)
¶
Generate ISEA4T DGGS grid for pure Python usage. Args: resolution (int): ISEA4T resolution [0..39] bbox (list[float]): [min_lon, min_lat, max_lon, max_lat] output_format (str): Output output_format ('geojson', 'csv', etc.) fix_antimeridian (str): Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Returns: dict or list: GeoJSON FeatureCollection, list of ISEA4T cell IDs, or file path depending on output_format
Source code in vgrid/generator/isea4tgrid.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | |
ISEA3H Grid Generator Module
Generates ISEA3H DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical hexagonal grid system.
Key Functions: - isea3h_grid(): Main grid generation function for whole world - isea3h_grid_within_bbox(): Grid generation within bounding box - isea3hgrid(): User-facing function with multiple output formats - isea3hgrid_cli(): Command-line interface for grid generation
get_isea3h_children_cells(base_cells, target_resolution)
¶
Recursively generate DGGS cells for the desired resolution, returning only the cells at the target resolution.
Source code in vgrid/generator/isea3hgrid.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | |
get_isea3h_children_cells_within_bbox(bounding_cell, bbox, target_resolution)
¶
Recursively generate DGGS cells within a bounding box, returning only the cells at the target resolution.
Source code in vgrid/generator/isea3hgrid.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
isea3h_grid(resolution, fix_antimeridian=None)
¶
Generate DGGS cells and convert them to GeoJSON features.
Source code in vgrid/generator/isea3hgrid.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
isea3h_grid_ids(resolution)
¶
Return a list of ISEA3H cell IDs for the whole world at a given resolution.
Source code in vgrid/generator/isea3hgrid.py
152 153 154 155 156 157 158 | |
isea3h_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of ISEA3H cell IDs intersecting the given bounding box at a given resolution.
Source code in vgrid/generator/isea3hgrid.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
isea3hgrid(resolution, bbox=None, output_format='gpd', fix_antimeridian=None)
¶
Generate ISEA3H grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
ISEA3H resolution [0..40] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output output_format ('geojson', 'csv', etc). Defaults to None (list of IDs). |
'gpd'
|
fix_antimeridian
|
str
|
Antimeridian fixing method: shift, shift_balanced, shift_west, shift_east, split, none Defaults to False when None or omitted. |
None
|
Returns:
| Type | Description |
|---|---|
|
dict or list: GeoJSON FeatureCollection, file path, or list of IDs depending on output_format |
Source code in vgrid/generator/isea3hgrid.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | |
EASE Grid Generator Module
Generates EASE (Equal-Area Scalable Earth) DGGS grids for specified resolutions with automatic cell generation and validation using equal-area projection system.
Key Functions: - ease_grid(): Main grid generation function for whole world - ease_grid_within_bbox(): Grid generation within bounding box - easegrid(): User-facing function with multiple output formats - easegrid_cli(): Command-line interface for grid generation
ease_grid_ids(resolution)
¶
Return a list of EASE-DGGS cell IDs for the whole world at a given resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
EASE resolution [0..6] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of EASE cell IDs |
Source code in vgrid/generator/easegrid.py
76 77 78 79 80 81 82 83 84 85 86 87 | |
ease_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of EASE-DGGS cell IDs that intersect a bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
EASE resolution [0..6] |
required |
bbox
|
list[float]
|
[min_lon, min_lat, max_lon, max_lat] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of EASE cell IDs intersecting the bbox |
Source code in vgrid/generator/easegrid.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | |
get_ease_cells(resolution)
¶
Generate a list of cell IDs based on the resolution, row, and column.
Source code in vgrid/generator/easegrid.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
DGGAL Grid Generator Module
Generates DGGAL (Discrete Global Grids with Adaptive Localization) grids for multiple grid types with automatic cell generation and validation.
Key Functions: - dggalgen(): User-facing function with multiple output formats - dggalgen_cli(): Command-line interface for grid generation
dggalgen(dggs_type='gnosis', resolution=1, bbox=None, compact=False, output_format=None, split_antimeridian=False)
¶
Generate a DGGAL grid using the dggal library directly.
When output_format is provided, save to the current folder using a predefined
name (e.g., "
Parameters¶
dggs_type : str, default "gnosis" DGGAL DGGS type. resolution : int, default 1 Resolution level. bbox : tuple[float, float, float, float] | None, optional Bounding box as (min_lon, min_lat, max_lon, max_lat). compact : bool, default False Whether to compact zones. output_format : str | None, optional Output format. split_antimeridian : bool, default False When True, apply antimeridian fixing to the resulting polygons.
Source code in vgrid/generator/dggalgen.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
DGGRID Grid Generator Module
Generates DGGRID grids for multiple grid types with automatic cell generation and validation using the DGGRID library.
Key Functions: - generate_grid(): Core grid generation function with DGGRID instance - dggridgen(): User-facing function with multiple output formats - dggridgen_cli(): Command-line interface for grid generation
dggridgen(dggrid_instance, dggs_type, resolution, bbox=None, output_address_type=None, output_format='gpd', split_antimeridian=False, aggregate=False)
¶
Generate DGGRID grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dggrid_instance
|
DGGRID instance for grid operations |
required | |
dggs_type
|
str
|
DGGS type from dggs_types |
required |
resolution
|
int
|
Resolution level |
required |
bbox
|
list
|
Bounding box [min_lat, min_lon, max_lat, max_lon]. Defaults to None (whole world). |
None
|
output_address_type
|
str
|
Address type for output. Defaults to None. |
None
|
output_format
|
str
|
Output format handled entirely by convert_to_output_format |
'gpd'
|
split_antimeridian
|
bool
|
When True, apply antimeridian fixing to the resulting polygons. Defaults to False when None or omitted. |
False
|
Returns:
| Type | Description |
|---|---|
|
Delegated to convert_to_output_format |
Source code in vgrid/generator/dggridgen.py
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
QTM Grid Generator Module
Generates QTM (Quaternary Triangular Mesh) DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical triangular grid system.
Key Functions: - qtm_grid(): Main grid generation function for whole world - qtm_grid_within_bbox(): Grid generation within bounding box - qtmgrid(): User-facing function with multiple output formats - qtmgrid_cli(): Command-line interface for grid generation
OLC Grid Generator Module
Generates OLC (Open Location Code) DGGS grids for specified resolutions with automatic cell generation and validation using human-readable location codes.
Key Functions: - olc_grid(): Main grid generation function for whole world - olc_grid_within_bbox(): Grid generation within bounding box - olcgrid(): User-facing function with multiple output formats - olcgrid_cli(): Command-line interface for grid generation
olc_grid_ids(resolution)
¶
Return a list of OLC (Plus Code) IDs for the whole world at the given resolution.
Source code in vgrid/generator/olcgrid.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 | |
olc_grid_resample(resolution, geojson_features)
¶
Generate a grid of Open Location Codes (Plus Codes) within the specified GeoJSON features.
Source code in vgrid/generator/olcgrid.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
olc_grid_within_bbox(resolution, bbox)
¶
Generate a grid of Open Location Codes (Plus Codes) within the specified bounding box.
Source code in vgrid/generator/olcgrid.py
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
olc_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of OLC (Plus Code) IDs within a bounding box at the given resolution.
Source code in vgrid/generator/olcgrid.py
266 267 268 269 270 271 272 273 274 | |
olc_refine_cell(bounds, current_resolution, target_resolution, bbox_poly)
¶
Refine a cell defined by bounds to the target resolution, recursively refining intersecting cells.
Source code in vgrid/generator/olcgrid.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | |
olcgrid(resolution, bbox=None, output_format='gpd')
¶
Generate OLC grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
OLC resolution [2..15] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', 'geo', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of OLC IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output in the requested format or file path. |
Source code in vgrid/generator/olcgrid.py
277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 | |
Geohash Grid Generator Module
Generates Geohash DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical geocoding system.
Key Functions: - geohash_grid(): Main grid generation function for whole world - geohash_grid_within_bbox(): Grid generation within bounding box - geohashgrid(): User-facing function with multiple output formats - geohashgrid_cli(): Command-line interface for grid generation
Reference: https://geohash.softeng.co/uekkn, https://github.com/vinsci/geohash, https://www.movable-type.co.uk/scripts/geohash.html?geohash=dp3
expand_geohash_bbox(gh, target_length, geohashes, bbox_polygon)
¶
Expand geohash only if it intersects the bounding box.
Source code in vgrid/generator/geohashgrid.py
56 57 58 59 60 61 62 63 64 65 66 67 | |
geohash_grid(resolution)
¶
Generate GeoJSON for the entire world at the given geohash resolution.
Source code in vgrid/generator/geohashgrid.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
geohash_grid_ids(resolution)
¶
Return a list of Geohash IDs for the whole world at the given resolution.
Source code in vgrid/generator/geohashgrid.py
111 112 113 114 115 116 117 118 119 | |
geohash_grid_resample(resolution, geojson_features)
¶
Generate GeoJSON for geohashes within a GeoJSON feature collection at the given resolution.
Source code in vgrid/generator/geohashgrid.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
geohash_grid_within_bbox(resolution, bbox)
¶
Generate GeoJSON for geohashes within a bounding box at the given resolution.
Source code in vgrid/generator/geohashgrid.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
geohash_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of Geohash IDs intersecting the given bounding box at the given resolution.
Source code in vgrid/generator/geohashgrid.py
122 123 124 125 126 127 128 129 130 131 132 133 134 | |
geohashgrid(resolution, bbox=None, output_format='gpd')
¶
Generate Geohash grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
Geohash resolution [1..10] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of Geohash IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output in the requested format or file path. |
Source code in vgrid/generator/geohashgrid.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
GEOREF Grid Generator Module
Generates GEOREF DGGS grids for specified resolutions with automatic cell generation and validation using World Geographic Reference System.
Key Functions: - georef_grid(): Main grid generation function with bounding box support - georef_grid_ids(): Returns list of GEOREF IDs for given bbox and resolution - georefgrid(): User-facing function with multiple output formats - georefgrid_cli(): Command-line interface for grid generation
georef_grid_ids(resolution, bbox=None)
¶
Return a list of GEOREF IDs for a given bounding box at the specified resolution.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
bbox
|
list[float]
|
[min_lon, min_lat, max_lon, max_lat] |
None
|
resolution
|
int
|
GEOREF resolution [0..4] |
required |
Returns:
| Type | Description |
|---|---|
|
list[str]: List of GEOREF IDs |
Source code in vgrid/generator/georefgrid.py
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
georefgrid(resolution, bbox=None, output_format='gpd')
¶
Generate GEOREF grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
GEOREF resolution [0..4] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', 'geo', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of GEOREF IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output in the requested format or file path. |
Source code in vgrid/generator/georefgrid.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
MGRS Grid Generator Module
Generates MGRS (Military Grid Reference System) DGGS grids for specified resolutions with automatic cell generation and validation using NATO military coordinate system.
Key Functions: - mgrs_grid(): Main grid generation function with GZD support - mgrsgrid(): User-facing function with multiple output formats - mgrsgrid_cli(): Command-line interface for grid generation
is_valid_gzd(gzd)
¶
Check if a Grid Zone Designator (GZD) is valid.
Source code in vgrid/generator/mgrsgrid.py
28 29 30 31 | |
mgrs_grid_ids(gzd, resolution)
¶
Return a list of MGRS IDs for a given GZD and resolution.
Source code in vgrid/generator/mgrsgrid.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | |
mgrsgrid(gzd, resolution, output_format='gpd')
¶
Generate MGRS grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gzd
|
str
|
Grid Zone Designator, e.g. '48P'. |
required |
resolution
|
int
|
MGRS resolution [0..5]. |
required |
output_format
|
str
|
Output format ('geojson', 'csv', 'geo', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of MGRS IDs). Defaults to None. |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
Depends on output_format: list, GeoDataFrame, file path, or GeoJSON FeatureCollection. |
Source code in vgrid/generator/mgrsgrid.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
Tilecode Grid Generator Module
Generates Tilecode DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical geospatial indexing system.
Key Functions: - tilecode_grid(): Main grid generation function with bounding box support - tilecode_grid_resample(): Grid generation within GeoJSON features - tilecodegrid(): User-facing function with multiple output formats - tilecodegrid_cli(): Command-line interface for grid generation
tilecode_grid_ids(resolution)
¶
Return a list of Tilecode IDs for the whole world at the given resolution.
Source code in vgrid/generator/tilecodegrid.py
97 98 99 100 101 102 103 104 105 106 107 108 109 | |
tilecode_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of Tilecode IDs intersecting the given bounding box at the given resolution.
Source code in vgrid/generator/tilecodegrid.py
112 113 114 115 116 117 118 119 120 121 122 123 | |
tilecodegrid(resolution, bbox=None, output_format='gpd')
¶
Generate Tilecode grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
Tilecode resolution [0..26] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', etc.). Defaults to None (list of Tilecode IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output depending on output_format |
Source code in vgrid/generator/tilecodegrid.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
Quadkey Grid Generator Module
Generates Quadkey DGGS grids for specified resolutions with automatic cell generation and validation using hierarchical geospatial indexing system.
Key Functions: - quadkey_grid(): Main grid generation function with bounding box support - quadkey_grid_resample(): Grid generation within GeoJSON features - quadkeygrid(): User-facing function with multiple output formats - quadkeygrid_cli(): Command-line interface for grid generation
quadkey_grid_ids(resolution)
¶
Return a list of Quadkey IDs for the whole world at the given resolution.
Source code in vgrid/generator/quadkeygrid.py
97 98 99 100 101 102 103 104 105 106 107 108 | |
quadkey_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of Quadkey IDs intersecting the given bounding box at the given resolution.
Source code in vgrid/generator/quadkeygrid.py
111 112 113 114 115 116 117 118 119 120 121 | |
quadkeygrid(resolution, bbox=None, output_format='gpd')
¶
Generate Quadkey grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
Quadkey resolution [0..26] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', etc.). Defaults to None (list of Quadkey IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output depending on output_format |
Source code in vgrid/generator/quadkeygrid.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |
Maidenhead Grid Generator Module
Generates Maidenhead DGGS grids for specified resolutions with automatic cell generation and validation using amateur radio grid square system.
Key Functions: - maidenhead_grid(): Main grid generation function for whole world - maidenhead_grid_within_bbox(): Grid generation within bounding box - maidenheadgrid(): User-facing function with multiple output formats - maidenheadgrid_cli(): Command-line interface for grid generation
Reference
maidenhead_grid_ids(resolution)
¶
Return a list of Maidenhead IDs for the whole world at the given resolution.
Source code in vgrid/generator/maidenheadgrid.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 | |
maidenhead_grid_within_bbox_ids(resolution, bbox)
¶
Return a list of Maidenhead IDs intersecting the given bbox at the given resolution.
Source code in vgrid/generator/maidenheadgrid.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | |
maidenheadgrid(resolution, bbox=None, output_format='gpd')
¶
Generate Maidenhead grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
Maidenhead resolution [1..4] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', etc.). Defaults to None (list of Maidenhead IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output depending on output_format |
Source code in vgrid/generator/maidenheadgrid.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
GARS Grid Generator Module
Generates GARS (Global Area Reference System) DGGS grids for specified resolutions with automatic cell generation and validation using military grid reference system.
Key Functions: - gars_grid(): Main grid generation function for whole world - gars_grid_within_bbox(): Grid generation within bounding box - garsgrid(): User-facing function with multiple output formats - garsgrid_cli(): Command-line interface for grid generation
gars_grid_ids(resolution, bbox=None)
¶
Return a list of GARS IDs for the whole world at the given resolution.
Source code in vgrid/generator/garsgrid.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
garsgrid(resolution, bbox=None, output_format='gpd')
¶
Generate GARS grid for pure Python usage.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
resolution
|
int
|
GARS resolution [1..4] |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', etc.). Defaults to None (list of GARS IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output depending on output_format |
Source code in vgrid/generator/garsgrid.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |
VGRID Grid Generator Module
Generates VGRID DGGS grids for specified resolutions and bounding boxes with automatic cell generation and validation.
Key Functions: - vgrid_gen_ids(): Generate VGRID IDs only (returns list of strings) - vgrid_gen(): Main grid generation function with bounding box support (returns GeoDataFrame) - vgridgen(): User-facing function with multiple output formats - vgridgen_cli(): Command-line interface for grid generation
vgrid_gen(vgrid_instance, resolution=0, bbox=None)
¶
Generate a VGRID grid for a given VGRID instance and bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vgrid_instance
|
VGRID
|
VGRID instance |
required |
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
resolution
|
int
|
Resolution level to generate. If None, uses VGRID instance resolution. |
0
|
Returns:
| Name | Type | Description |
|---|---|---|
GeoDataFrame |
GeoDataFrame
|
VGRID grid cells within the bounding box |
Source code in vgrid/generator/vgridgen.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
vgrid_gen_ids(vgrid_instance, resolution=0, bbox=None)
¶
Generate VGRID IDs for a given VGRID instance and bounding box.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vgrid_instance
|
VGRID
|
VGRID instance |
required |
resolution
|
int
|
Resolution level to generate. If None, uses VGRID instance resolution. |
0
|
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
Returns:
| Type | Description |
|---|---|
list[str]
|
list[str]: List of VGRID cell IDs within the bounding box |
Source code in vgrid/generator/vgridgen.py
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
vgridgen(vgrid_instance, resolution=0, bbox=None, output_format='gpd')
¶
Generate VGRID grid for pure Python usage.
Note: Create a VGRID instance first using VGRID(cell_size, aperture).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
vgrid_instance
|
VGRID
|
VGRID instance (create with VGRID(cell_size, aperture)) |
required |
resolution
|
int
|
Resolution level to generate. If None, uses VGRID instance resolution. |
0
|
bbox
|
list
|
Bounding box [min_lon, min_lat, max_lon, max_lat]. Defaults to None (whole world). |
None
|
output_format
|
str
|
Output format ('geojson', 'csv', 'gpd', 'shapefile', 'gpkg', 'parquet', or None for list of VGRID IDs). |
'gpd'
|
Returns:
| Type | Description |
|---|---|
|
dict, list, or str: Output in the requested format or file path. |
Source code in vgrid/generator/vgridgen.py
148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
vgridgen_cli()
¶
CLI interface for generating VGRID grid.
Source code in vgrid/generator/vgridgen.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | |