API Docs¶
Main Functions¶
Parse a GeoJSON file or data struc into a normalized FeatureCollection.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
geojson_raw
|
str | bytes | dict
|
GeoJSON file path, JSON string, dict, or file bytes. |
required |
merge
|
bool
|
If any nested Polygons / MultiPolygon should be merged. |
False
|
Returns:
Name | Type | Description |
---|---|---|
FeatureCollection |
FeatureCollection
|
a FeatureCollection. |
Source code in geojson_aoi/parser.py
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 156 |
|
options: show_source: false heading_level: 3
Helper Functions¶
Enforce GeoJSON is wrapped in FeatureCollection.
The type check is done directly from the GeoJSON to allow parsing from different upstream libraries (e.g. geojson_pydantic).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
geojson_obj
|
dict
|
a parsed geojson, to wrap in a FeatureCollection. |
required |
Returns:
Name | Type | Description |
---|---|---|
FeatureCollection |
FeatureCollection
|
a FeatureCollection. |
Source code in geojson_aoi/parser.py
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 |
|
options: show_source: false heading_level: 3
Merge multiple Polygons or MultiPolygons into a single Polygon.
It is used to create a single polygon boundary.
Automatically determine whether to use union (for overlapping polygons) or convex hull (for disjoint polygons).
As a result of the processing, any Feature properties will be lost.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
featcol
|
FeatureCollection
|
a FeatureCollection containing geometries. |
required |
Returns:
Name | Type | Description |
---|---|---|
FeatureCollection |
FeatureCollection
|
a FeatureCollection of a single Polygon. |
Source code in geojson_aoi/merge.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 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 |
|
options: show_source: false heading_level: 3
Warn the user if an invalid CRS is detected.
Also does a rough check for one geometry, to determine if the coordinates are range 90/180 degree range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
featcol
|
FeatureCollection
|
a FeatureCollection. |
required |
Returns:
Name | Type | Description |
---|---|---|
FeatureCollection |
None
|
a FeatureCollection. |
Source code in geojson_aoi/parser.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 65 66 67 68 69 70 71 72 73 74 75 76 |
|
options: show_source: false heading_level: 3