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

Improve point validation #144

Merged
merged 2 commits into from
May 8, 2020
Merged

Improve point validation #144

merged 2 commits into from
May 8, 2020

Conversation

Rumpelstinsk
Copy link
Contributor

When you initialize a point using coordinates for a line, it says is a valid point:

import geojson

lineCoords=[[1,2],[3,4]]
pointCoords=[5,6]

print ("Line(lineCoords): ", geojson.LineString(lineCoords).is_valid)
print ("Line(pointCoors): ", geojson.LineString(pointCoords).is_valid)
print ("Point(pointCoords): ", geojson.Point(pointCoords).is_valid)
print ("Point(lineCoords): ", geojson.Point(lineCoords).is_valid)

Which produces the next exit:

Line(lineCoords): True
Line(pointCoors): False
Point(pointCoords): True
Point(lineCoords): True

The reason behind this, is because the position array is only validating it's length, but not the format.

I think this pull request solves the problem

@codecov
Copy link

codecov bot commented May 8, 2020

Codecov Report

Merging #144 into master will decrease coverage by 0.51%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #144      +/-   ##
==========================================
- Coverage   94.78%   94.26%   -0.52%     
==========================================
  Files          10       10              
  Lines         345      349       +4     
  Branches       69       71       +2     
==========================================
+ Hits          327      329       +2     
- Misses         10       11       +1     
- Partials        8        9       +1     
Impacted Files Coverage Δ
geojson/geometry.py 100.00% <100.00%> (ø)
geojson/utils.py 84.76% <0.00%> (-1.91%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1a47d5...522bdec. Read the comment docs.

@auvipy auvipy merged commit f56f28e into jazzband:master May 8, 2020
@Rumpelstinsk Rumpelstinsk deleted the improve_point_validation branch May 8, 2020 08:20
@rayrrr rayrrr mentioned this pull request Jan 26, 2023
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 2, 2023
3.0.1 (2023-02-15)
------------------

- Add Support for Python 3.11.x minor revisions

  - jazzband/geojson#198


3.0.0 (2023-01-26)
------------------

- Support for Python versions 3.7-3.11 (Python 2 no longer supported)

- Primary development branch renamed from `master` to `main`

- Handle all real numbers as coordinates

  - jazzband/geojson#188

- Default precision improvements

  - jazzband/geojson#177

- CI improvements

  - jazzband/geojson#172
  - jazzband/geojson#155

- utf-8 support added to `geojson.dumps()`

  - jazzband/geojson#165

- Polygons now constrained to bounding box

  - jazzband/geojson#147

- Better GeometryCollection handling in `util.coords()`

  - jazzband/geojson#146

- Improved point validation

  - jazzband/geojson#144
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.

2 participants