`pygeos.set_precision` creates empty geometries
See original GitHub issueIf you round a LineString until you get a single coordinate value, pygeos.set_precision
returns an empty geometry. Shouldn’t it return a single point instead?
geometry = pygeos.linestrings([np.array([0.01, 0.02]), np.array([0.03, 0.04]), np.array([0.05, 0.06])])
# <pygeos.Geometry LINESTRING (0.01 0.02, 0.03 0.04, 0.05 0.06)>
pygeos.set_precision(geometry, 1)
# <pygeos.Geometry LINESTRING EMPTY>
Expected result:
# <pygeos.Geometry POINT (0 0)>
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Set operations — pygeos documentation - Read the Docs
Returns the union of multiple polygons of a geometry collection. This is an optimized version of union which assumes the polygons to be...
Read more >Allow creating empty geometries in constructive functions #149
In general, the question is how we can facilitate creating empty geometries in PyGEOS. Currently, if you want to create an empty geometry,...
Read more >Truncating points precision - python - GIS Stack Exchange
I have geopandas with CRS in meters (ITM {'init' :'epsg:2039'}) . I converted the geometry from espg:4326 so I have very high precision...
Read more >Missing and empty geometries - GeoPandas
Missing and empty geometries#. GeoPandas supports, just like in pandas, the concept of missing values (NA or null values). But for geometry values, ......
Read more >COVID-19 New Cases in Italy prediction (arima) | Kaggle
Pandas profiling is a Python library that generates a detailed report of a ... fontweight='bold') # empty array for the data range sm....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
And I see that using
make_valid
on the LineString with 2 equal vertices, indeed gives a Point instead of an empty LineString (asset_precision
does). You could certainly bring it up with the GEOS project if they have a reasoning for collapsing to empty geometries instead of collapsing to a “lower dimension geometry” inset_precision
(while having a different logic inmake_valid
).Yes, in my use case I was able to find some examples of invalid linestring with duplicate coordinates, that’s why I was using
pygeos.make_valid
function afterwards to fix them.However I don’t know what kinds of other problems this approach might cause to polygons for example, and if they are fixable. But the idea here was to include as many geometries as possible during analysis.