Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions src/geography.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -285,15 +285,15 @@ void init_geography(py::module &m) {
pygeography_types.value(
"LINESTRING", GeographyType::LineString, "Single line geography type (1).");
pygeography_types.value(
"POLYGON", GeographyType::Polygon, "Single polygon geography type (2).");
"POLYGON", GeographyType::Polygon, "Single polygon geography type (3).");
pygeography_types.value(
"MULTIPOINT", GeographyType::MultiPoint, "Multiple point geography type (3).");
"MULTIPOINT", GeographyType::MultiPoint, "Multiple point geography type (4).");
pygeography_types.value(
"MULTILINESTRING", GeographyType::MultiLineString, "Multiple line geography type (4).");
"MULTILINESTRING", GeographyType::MultiLineString, "Multiple line geography type (5).");
pygeography_types.value(
"MULTIPOLYGON", GeographyType::MultiPolygon, "Multiple polygon geography type (5).");
"MULTIPOLYGON", GeographyType::MultiPolygon, "Multiple polygon geography type (6).");
pygeography_types.value(
"GEOMETRYCOLLECTION", GeographyType::GeometryCollection, "Collection geography type (6).");
"GEOMETRYCOLLECTION", GeographyType::GeometryCollection, "Collection geography type (7).");

// Geography classes

Expand Down Expand Up @@ -333,11 +333,15 @@ void init_geography(py::module &m) {
- None (missing) is -1
- POINT is 0
- LINESTRING is 1
- POLYGON is 2
- MULTIPOINT is 3
- MULTILINESTRING is 4
- MULTIPOLYGON is 5
- GEOMETRYCOLLECTION is 6
- POLYGON is 3
- MULTIPOINT is 4
- MULTILINESTRING is 5
- MULTIPOLYGON is 6
- GEOMETRYCOLLECTION is 7

Those ID numbers are consistent with Shapely geometry types
(note that Spherely has no LINEARRING type, hence the jump from
1 to 3 between LINESTRING and POLYGON).

Parameters
----------
Expand Down
2 changes: 1 addition & 1 deletion src/geography.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ enum class GeographyType : std::int8_t {
None = -1,
Point,
LineString,
Polygon,
Polygon = 3,
MultiPoint,
MultiLineString,
MultiPolygon,
Expand Down
10 changes: 5 additions & 5 deletions tests/test_geography.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ def test_geography_type() -> None:
assert spherely.GeographyType.NONE.value == -1
assert spherely.GeographyType.POINT.value == 0
assert spherely.GeographyType.LINESTRING.value == 1
assert spherely.GeographyType.POLYGON.value == 2
assert spherely.GeographyType.MULTIPOINT.value == 3
assert spherely.GeographyType.MULTILINESTRING.value == 4
assert spherely.GeographyType.MULTIPOLYGON.value == 5
assert spherely.GeographyType.GEOMETRYCOLLECTION.value == 6
assert spherely.GeographyType.POLYGON.value == 3
assert spherely.GeographyType.MULTIPOINT.value == 4
assert spherely.GeographyType.MULTILINESTRING.value == 5
assert spherely.GeographyType.MULTIPOLYGON.value == 6
assert spherely.GeographyType.GEOMETRYCOLLECTION.value == 7


def test_is_geography() -> None:
Expand Down
Loading