Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH: get_m and point.m property #2019

Merged
merged 2 commits into from Mar 22, 2024
Merged

ENH: get_m and point.m property #2019

merged 2 commits into from Mar 22, 2024

Conversation

mwtoews
Copy link
Member

@mwtoews mwtoews commented Mar 12, 2024

Adds get_m and a m point property, available with GEOS 3.12 or later. For example:

import shapely

assert shapely.geos_version[0:2] >= (3, 12), shapely.geos_version_string

pt = shapely.from_wkt("POINT M (1 2 4)")
assert pt.m == shapely.get_m(pt) == 4.0

And similar to the z property:

pt = shapely.geometry.Point(1, 2)
shapely.get_m(pt)  # nan
pt.m
# raises: DimensionError: This point has no m coordinate.

Other checks to shapely/tests/geometry/test_point.py will be added after reworking Point().

@mwtoews mwtoews force-pushed the get-m branch 2 times, most recently from 2d50bf6 to c0b586d Compare March 12, 2024 10:56
@coveralls
Copy link

coveralls commented Mar 12, 2024

Pull Request Test Coverage Report for Build 8313966708

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 9 of 10 (90.0%) changed or added relevant lines in 2 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.3%) to 88.122%

Changes Missing Coverage Covered Lines Changed/Added Lines %
shapely/geometry/point.py 4 5 80.0%
Files with Coverage Reduction New Missed Lines %
shapely/creation.py 1 99.06%
shapely/geometry/base.py 4 92.22%
shapely/coordinates.py 4 90.48%
Totals Coverage Status
Change from base Build 8239849488: 0.3%
Covered Lines: 2619
Relevant Lines: 2972

💛 - Coveralls

shapely/geometry/point.py Outdated Show resolved Hide resolved
@mwtoews
Copy link
Member Author

mwtoews commented Mar 17, 2024

@jorisvandenbossche do you have any idea why "Create a merge commit" is no longer enabled for this repository? This is usually my "go to" method, otherwise I can manually re-write this PR with one commit. Actually, "Squash and merge" is my "go to" method, so that's fine with me.

@mwtoews mwtoews merged commit aa23ce0 into shapely:main Mar 22, 2024
24 checks passed
@mwtoews mwtoews deleted the get-m branch March 22, 2024 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants