Skip to content

Commit

Permalink
H3Shape -> Shape
Browse files Browse the repository at this point in the history
  • Loading branch information
ajfriend committed May 4, 2024
1 parent ddf02b4 commit 3897253
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docs/api_quick.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Note that this is reversed from [``__geo_interface__``](https://gist.github.com/
.. currentmodule:: h3
.. autosummary::
H3Shape
Shape
LatLngPoly
LatLngMultiPoly
```
Expand Down
22 changes: 11 additions & 11 deletions docs/polygon_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
"\n",
"`h3-py` can convert between sets of cells and GeoJSON-like polygon and multipolygon shapes.\n",
"\n",
"We use the abstract base class `H3Shape` and its concrete child classes `LatLngPoly` and `LatLngMultiPoly`\n",
"We use the abstract base class `Shape` and its concrete child classes `LatLngPoly` and `LatLngMultiPoly`\n",
"to represent these shapes. \n",
"Any references or function names that use \"H3Shape\" will apply to both `LatLngPoly` and `LatLngMultiPoly` objects.\n",
"Any references or function names that use \"Shape\" will apply to both `LatLngPoly` and `LatLngMultiPoly` objects.\n",
"\n",
"`h3-py` is also compatible with Python objects that implement `__geo_interface__` (https://gist.github.com/sgillies/2217756),\n",
"making it easy to interface with other Python geospatial libraries.\n",
Expand Down Expand Up @@ -455,7 +455,7 @@
"source": [
"## MultiPolygon to cells\n",
"\n",
"`h3.shape_to_cells()` works on both `LatLngMultiPoly` and `LatLngPoly` objects (both are subclasses of `H3Shape`)."
"`h3.shape_to_cells()` works on both `LatLngMultiPoly` and `LatLngPoly` objects (both are subclasses of `Shape`)."
]
},
{
Expand Down Expand Up @@ -604,37 +604,37 @@
"# API Summary\n",
"\n",
"```\n",
"\"Geo object\" <-> H3Shape <-> H3 cells\n",
"\"Geo object\" <-> Shape <-> H3 cells\n",
"```\n",
"\n",
"\"Geo objects\" are any Python object that implements `__geo_interface__`. This is a widely used\n",
"standard in geospatial Python and is used by libraries like `geopandas` and Shapely.\n",
"\n",
"`H3Shape` is an abstract class implemented by `LatLngPoly` and `LatLngMultiPoly`, each of which\n",
"`Shape` is an abstract class implemented by `LatLngPoly` and `LatLngMultiPoly`, each of which\n",
"implement `__geo_interface__` and can be created from external \"Geo objects\":\n",
"\n",
"- `geo_to_shape()`\n",
"- `shape_to_geo()`\n",
"\n",
"`H3Shape` objects can be converted to and from sets of H3 cells:\n",
"`Shape` objects can be converted to and from sets of H3 cells:\n",
"\n",
"- `shape_to_cells()`\n",
"- `cells_to_shape()`\n",
"\n",
"For convience, we provide functions that hide the intermediate `H3Shape` representation:\n",
"For convience, we provide functions that hide the intermediate `Shape` representation:\n",
"\n",
"- `geo_to_cells()`\n",
"- `cells_to_geo()`\n",
"\n",
"## Equivalance notes\n",
"\n",
"Note that if an object `a` is an `H3Shape`\n",
"Note that if an object `a` is an `Shape`\n",
"then the following two expressions are equivalent:\n",
"\n",
"- `shape_to_geo(a)`\n",
"- `a.__geo_interface__`\n",
"\n",
"Also note that if `a` is an `H3Shape`, then `a` \"passes through\" `geo_to_shape()`:\n",
"Also note that if `a` is an `Shape`, then `a` \"passes through\" `geo_to_shape()`:\n",
"\n",
"```python\n",
"geo_to_shape(a) == a\n",
Expand Down Expand Up @@ -808,7 +808,7 @@
"## Converting cells to \"geo objects\"\n",
"\n",
"If we assign `df.geometry = cell_column` we'll get an error because the `geometry` column of a `geopandas.GeoDataFrame` must contain valid geometry objects.\n",
"We can obtain compatible objects by converting the cells to `H3Shape` by applying `h3.cells_to_shape()`.\n",
"We can obtain compatible objects by converting the cells to `Shape` by applying `h3.cells_to_shape()`.\n",
"\n",
"(Note that, unfortunately, Pandas has some logic to identify iterable members of a series and then renders a tuple of the elements, rather than our preferred `LatLngMultiPoly.__repr__` representation.)"
]
Expand Down Expand Up @@ -857,7 +857,7 @@
"id": "6ae6afb2-8267-492a-836e-cf371df91e89",
"metadata": {},
"source": [
"Now, if we assign `df.geometry = shape_column`, our `H3Shape` objects will automatically be converted to Shapely Polygon and MultiPolygon objects via `__geo_interface__`."
"Now, if we assign `df.geometry = shape_column`, our `Shape` objects will automatically be converted to Shapely Polygon and MultiPolygon objects via `__geo_interface__`."
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/h3/api/basic_int/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ def shape_to_cells(shape, res):
Parameters
----------
shape : ``H3shape``
shape : ``Shape``
res : int
Resolution of the output cells
Expand Down

0 comments on commit 3897253

Please sign in to comment.