diff --git a/latest b/latest index d393549..73c28b5 120000 --- a/latest +++ b/latest @@ -1 +1 @@ -v0.3.11 \ No newline at end of file +v0.3.12 \ No newline at end of file diff --git a/v0.3.12/404.html b/v0.3.12/404.html new file mode 100644 index 0000000..47e6e5d --- /dev/null +++ b/v0.3.12/404.html @@ -0,0 +1,450 @@ + + + +
+ + + + + + + + + + + + + + + + +Fix antimeridian crossings in GeoJSON objects and shapely geometries.
+ + + + + + + + +
+ Bases: AntimeridianWarning
The input shape is wound clockwise (instead of counter-clockwise), so +this package is reversing the winding order before fixing the shape.
+ + + + + + +src/antimeridian/_implementation.py
38 +39 +40 +41 +42 +43 +44 +45 +46 +47 +48 +49 +50 +51 +52 +53 +54 |
|
+ Bases: Protocol
A simple protocol for things that have a __geo_interface__
method.
The __geo_interface__
protocol is described
+here, and is used within
+shapely to extract
+geometries from objects.
src/antimeridian/_implementation.py
57 +58 +59 +60 +61 +62 +63 +64 +65 +66 +67 |
|
bbox(shape: Dict[str, Any] | GeoInterface, force_over_antimeridian: bool = False) -> List[float]
+
Calculates a GeoJSON-spec conforming bounding box for a shape.
+Per the GeoJSON +spec, an +antimeridian-spanning bounding box should have its larger longitude as its +first bounding box coordinate.
+ + +Parameters:
+shape
+ (Dict[str, Any] | GeoInterface
)
+ –
+ The polygon or multipolygon for which to calculate the bounding box.
+force_over_antimeridian
+ (bool
, default:
+ False
+)
+ –
+ Force the bounding box to be over the antimeridian.
+Returns:
+List[float]
+ –
+ List[float]: The bounding box.
+src/antimeridian/_implementation.py
666 +667 +668 +669 +670 +671 +672 +673 +674 +675 +676 +677 +678 +679 +680 +681 +682 +683 +684 +685 +686 +687 +688 +689 +690 +691 +692 +693 +694 +695 +696 +697 +698 +699 +700 +701 +702 +703 +704 +705 +706 +707 +708 +709 +710 +711 +712 |
|
centroid(shape: Dict[str, Any] | GeoInterface) -> Point
+
Calculates the centroid for a polygon or multipolygon.
+Polygons are easy, we just use shapely.centroid. For +multi-polygons, the antimeridian is taken into account by calculating the +centroid from an identical multi-polygon with coordinates in [0, 360).
+ + +Parameters:
+shape
+ (Dict[str, Any] | GeoInterface
)
+ –
+ The polygon or multipolygon for which to calculate the centroid.
+Returns:
+Point
( Point
+) –
+ The centroid.
+src/antimeridian/_implementation.py
715 +716 +717 +718 +719 +720 +721 +722 +723 +724 +725 +726 +727 +728 +729 +730 +731 +732 +733 +734 +735 +736 +737 +738 +739 +740 +741 +742 +743 +744 +745 +746 +747 +748 +749 |
|
fix_geojson(geojson: Dict[str, Any], *, force_north_pole: bool = False, force_south_pole: bool = False, fix_winding: bool = True) -> Dict[str, Any]
+
Fixes a GeoJSON object that crosses the antimeridian.
+If the object does not cross the antimeridian, it is returned unchanged.
+See antimeridian.fix_polygon for a description of the force_north_pole
+force_south_pole
and fix_winding
arguments.
Parameters:
+geojson
+ (Dict[str, Any]
)
+ –
+ A GeoJSON object as a dictionary
+force_north_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the north pole.
+force_south_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the south pole.
+fix_winding
+ (bool
, default:
+ True
+)
+ –
+ If the polygon is wound clockwise, reverse its +coordinates before applying the algorithm.
+The same GeoJSON with a fixed geometry or geometries
+src/antimeridian/_implementation.py
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 |
|
fix_line_string(line_string: LineString) -> Union[LineString, MultiLineString]
+
Fixes a shapely.LineString.
+ + +Parameters:
+line_string
+ (LineString
)
+ –
+ The input line string
+Returns:
+Union[LineString, MultiLineString]
+ –
+ The fixed line string, either as a single line string or a multi-line
+Union[LineString, MultiLineString]
+ –
+ string (if it was split)
+src/antimeridian/_implementation.py
331 +332 +333 +334 +335 +336 +337 +338 +339 +340 +341 +342 +343 +344 +345 |
|
fix_multi_line_string(multi_line_string: MultiLineString) -> MultiLineString
+
Fixes a shapely.MultiLineString.
+ + +Parameters:
+multi_line_string
+ (MultiLineString
)
+ –
+ The input multi line string
+Returns:
+MultiLineString
+ –
+ The fixed multi line string
+src/antimeridian/_implementation.py
348 +349 +350 +351 +352 +353 +354 +355 +356 +357 +358 +359 +360 +361 +362 +363 +364 |
|
fix_multi_polygon(multi_polygon: MultiPolygon, *, force_north_pole: bool = False, force_south_pole: bool = False, fix_winding: bool = True) -> MultiPolygon
+
Fixes a shapely.MultiPolygon.
+See antimeridian.fix_polygon for a description of the force_north_pole
+force_south_pole
and fix_winding
arguments.
Parameters:
+multi_polygon
+ (MultiPolygon
)
+ –
+ The multi-polygon
+force_north_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the north pole.
+force_south_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the south pole.
+fix_winding
+ (bool
, default:
+ True
+)
+ –
+ If the polygon is wound clockwise, reverse its +coordinates before applying the algorithm.
+Returns:
+MultiPolygon
+ –
+ The fixed multi-polygon
+src/antimeridian/_implementation.py
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 +264 +265 +266 +267 +268 +269 +270 |
|
fix_polygon(polygon: Polygon, *, force_north_pole: bool = False, force_south_pole: bool = False, fix_winding: bool = True) -> Union[Polygon, MultiPolygon]
+
Fixes a shapely.Polygon.
+If the input polygon is wound clockwise, it will be fixed to be wound
+counterclockwise unless fix_winding
is False
in which case it
+will be corrected by adding a counterclockwise polygon from (-180, -90) to
+(180, 90) as its exterior.
In rare cases, the underlying algorithm might need a little help to fix the polygon.
+For example, a polygon that just barely crosses over a pole might have very
+few points at high latitudes, leading to ambiguous antimeridian crossing
+points and invalid geometries. We provide two flags, force_north_pole
+and force_south_pole
for those cases. Most users can ignore these
+flags.
If either force_north_pole
or force_south_pole
is True
+fix_winding
is set to False
Parameters:
+polygon
+ (Polygon
)
+ –
+ The input polygon
+force_north_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the north pole.
+force_south_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the south pole.
+fix_winding
+ (bool
, default:
+ True
+)
+ –
+ If the polygon is wound clockwise, reverse its +coordinates before applying the algorithm.
+Returns:
+Union[Polygon, MultiPolygon]
+ –
+ The fixed polygon, either as a single polygon or a multi-polygon (if it
+Union[Polygon, MultiPolygon]
+ –
+ was split)
+src/antimeridian/_implementation.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 +323 +324 +325 +326 +327 +328 |
|
fix_shape(shape: Dict[str, Any] | GeoInterface, *, force_north_pole: bool = False, force_south_pole: bool = False, fix_winding: bool = True) -> Dict[str, Any]
+
Fixes a shape that crosses the antimeridian.
+See antimeridian.fix_polygon for a description of the force_north_pole
+force_south_pole
and fix_winding
arguments.
Parameters:
+shape
+ (Dict[str, Any] | GeoInterface
)
+ –
+ A polygon, multi-polygon, line string, or multi-line string, +either as a dictionary or as a antimeridian.GeoInterface. Uses +shapely.geometry.shape under the hood.
+force_north_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the north pole.
+force_south_pole
+ (bool
, default:
+ False
+)
+ –
+ If the polygon crosses the antimeridian, force the +joined segments to enclose the south pole.
+fix_winding
+ (bool
, default:
+ True
+)
+ –
+ If the polygon is wound clockwise, reverse its +coordinates before applying the algorithm.
+Returns:
+Dict[str, Any]
+ –
+ The fixed shape as a dictionary
+src/antimeridian/_implementation.py
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 +204 +205 +206 +207 +208 +209 +210 +211 +212 +213 +214 +215 +216 +217 +218 +219 +220 +221 +222 |
|
segment_geojson(geojson: Dict[str, Any]) -> MultiLineString
+
Segments a GeoJSON object into a MultiLineString.
+If the object does not cross the antimeridian, its exterior and interior +line strings are returned unchanged.
+ + +Parameters:
+geojson
+ (Dict[str, Any]
)
+ –
+ A GeoJSON object as a dictionary
+A MutliLineString of segments.
+src/antimeridian/_implementation.py
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 |
|