51 Commits

Author SHA1 Message Date
Alan D. Snow
fd4163d4b5
DEP: GDAL 3.5+, numpy 1.24+ (#3166)
* DEP: Python 3.10+, GDAL 3.5+, numpy 1.24+

* Apply suggestions from code review

* DEP: GDAL 3.5+, numpy 1.24+

* Fix

* remove python 3.13 from conda matrix

---------

Co-authored-by: Sean Gillies <sean.gillies@gmail.com>
2024-09-09 21:59:11 -06:00
Sean Gillies
afc33d87a4
Allow rasterize() output to be captured in datasets (#3131)
* Allow rasterize() output to be captured in datasets.

Resolves #1018.

* Run pyupgrade on changed files
2024-08-10 17:58:41 -06:00
Pieter Roggemans
7f94c46eee
ENH: enable support for extra dtypes in features.shapes: int8 and float64 (#3125)
* ENH: enable support for more dtypes in features.shapes

* Update CHANGES.txt

* int8 needs gdal 3.7

* Add extra types to docstring

* Apply feedback: int8 only from version 3.7
2024-08-05 18:13:07 -06:00
Sean Gillies
24d0845e57
Adjust test expectations in light of 3.9.0 (#3091)
* Adjust test expectations in light of 3.9.0

* Appease flake8

* xfail new shape mask test

See #3074
2024-05-10 08:45:37 -06:00
Sean Gillies
8427430551
Re-enable non-string dtype for rasterize() (#3045)
* Re-enable non-string dtype for rasterize()

A test that passed but wasn't testing what it claimed to test has
been deleted.

Resolves #3043

* Update change log and version

* Switch to more explicit if/elif/else for dtype logic

Also fix a URL in a test that recently broke (fsspec change maybe?)
2024-03-26 10:36:33 -06:00
Sean Gillies
9520b69cd1
Simplify rasterize (#3003)
* Simplify rasterize by restricting default output to float64/int64

Like numpy.array(). This allows us to deprecate several dtype
helper functions.

GDAL 3.5 doesn't support int64, so we will replace with int32.

* Remove another helper.

* Enable fallback to uint32 for GDAL 3.5

Address other tests failing on 3.4

* Remove unneeded tests, parametrize some.

* Remove unused import.

* Add change log entry.

* Spelling correction.
2024-01-09 11:32:47 -07:00
Sean Gillies
ffa3053012
rasterize(): given an empty shapes sequence return an empty or filled array (#2993)
* Given an empty shapes sequence, rasterize() returns an empty array

Resolves #2743

* Add PR number to change log
2023-12-21 14:27:43 -07:00
Sean Gillies
01d778ad96
Release 1.3.8.post1 (#2923)
* Update version and change log

* RTD version 2

* Require Cython < 3

* Remove extra _matches function

* Skip a few tests if shapely cannot be imported.

Add "python_version < '3.12'" to test's shapely requirement. There
are no shapely wheels for 3.12 yet.

* Relax numpy requirement for installation

* Add a backend section

* With build isolation

* Require setuptools >= 67.8

* Update change log, this is 1.3.8.post1

* Bump to next dev version

* Add sphinx-rtd-theme dependency

---------

Co-authored-by: Sean Gillies <seangillies@Seans-MacBook-Air.local>
2023-10-10 10:02:12 -06:00
Sean Gillies
5dd56f352e
Extend sieve's input to allow opened datasets and multiband objects (#2838)
* Extend sieve's input to allow opened datasets and multiband objects

Resolves #2782

* Remove commented code, clean up imports
2023-05-22 14:14:58 -06:00
Sean Gillies
578a3c5bfc
Int8 related backports from main (#2834)
* Take into account GDAL >= 3.7 GDT_Int8 signed int8 datatype (fixes #2635) (#2656)

* ENH: Added int8 dtype to rasterize (#2780)

---------

Co-authored-by: Even Rouault <even.rouault@spatialys.com>
Co-authored-by: Alan D. Snow <alansnow21@gmail.com>
2023-05-18 13:33:53 -06:00
Alan D. Snow
7c1f35b509
Pass along strides to GDAL in MemoryDataset #2511 (#2512) (#2558)
* Pass along strides to GDAL in MemoryDataset #2511

when given non-contigous array on output pass along strides
information to GDAL.

* Add test for #2509

* Update changes.txt

Co-authored-by: Kirill Kouzoubov <Kirill888@gmail.com>
2022-08-19 09:11:52 -06:00
Sean Gillies
212ad76a4c
Snowman2 int64 (#2467)
* ENH: Add support for Int64 & UInt64 for GDAL 3.5+

* Use ubuntu-small, not full, also xfail a test for GDAL 3.5.0

Co-authored-by: snowman2 <alansnow21@gmail.com>
2022-05-29 20:37:56 -06:00
Alan D. Snow
6258810eb4
BUG: Prevent core dump with invalid input to rasterize (#2393) 2022-04-08 07:55:37 -06:00
Vincent Sarago
ba5e90c487
mapbox -> rasterio (#2321) 2021-10-22 09:04:05 -06:00
Sean Gillies
3847cc2410
Rewrite of from_bounds and geometry_window (#2116)
* Rewrite of from_bounds and geometry_window

Resolves #2112

* Remove unused parameters from call to geometry_window
2021-02-15 08:31:24 -07:00
Sean Gillies
264ccaa838
Make feature extraction tests robust with respect to noding (#2066)
* Make feature extraction tests robust with respect to noding

Resolves #2034

* Install test extras

* Add shapely

* Finish adjusting tests and tweaking build matrix
2020-12-11 15:44:59 -07:00
Ian Schneider
201a8d0143
flatten multipolygon to avoid holes in output (#2014)
related to 1274, a multipolygon was resulting in the same behavior
2020-10-15 12:49:12 -06:00
Brendan Ward
22043389e4
Add support for bounds of GeometryCollection (#1915)
* Add support for bounds of GeometryCollection; resolves #1914

* Fix broken test for invalid geometries, and catch more
2020-04-29 12:23:24 -06:00
Sean Gillies
d74afa1b0f Filter more categories of invalid geoms
Resolves #1815
2020-02-14 08:54:41 -07:00
Sean Gillies
83ec91e314 Add missing capfd fixture 2019-09-13 15:29:42 -06:00
Sean Gillies
104b63b33c Handle shape skipping warnings and update change log 2019-09-13 14:23:28 -06:00
Sean Gillies
9e30d22d6d
Switch sharing kwarg default to False (#1775)
* Switch sharing kwarg default to False

Resolves #1705

* Replace GDALOpenShared with GDALOpen except in one shim

* Revert two open_dataset to GDALOpen

* Run tests under gdb

* Increment ref count in WarpedVRTBase

* Open a new dataset handle in WarpedVRT

* Remove gdb

* Remove exceptions from open_dataset in _shim1

Makes usage much easier

* Fix in-memory dataset leaks in _reproject
2019-09-13 08:05:14 -06:00
Sean Gillies
073339ce57 Merge branch 'maint-1.0' 2019-08-06 18:42:38 -06:00
Sean Gillies
b806345964 fill value instead of default_value
Thanks @brendan-ward!

Resolves #1738
2019-07-30 15:49:03 -06:00
Sean Gillies
df11584101 Use default_value when shape's value is None
Resolves #1738
2019-07-30 15:04:02 -06:00
Brendan Ward
3d8836d9b1 Warn on rasterizing invalid / empty geometries instead of failing (#1680)
* Raise warnings rather than exceptions for invalid / empty shapes in rasterize

* Add test for geo interface for is_geom_valid and fix for travis builds

--no-use-pep517 flag for pip install of local environment is needed to get pip install working

* Make warning for invalid / empty geometry in rasterization more clear
2019-05-03 11:18:09 -06:00
Sean Gillies
98126f2abc
Add full support for numpy masked arrays to features.shapes() (#1523)
Resolves #1517
2018-10-25 14:08:45 -06:00
Sean Gillies
7b8d5e248b
Avoid losing a row or column in geometry_window() (#1472)
Resolves #1436
2018-09-18 20:53:03 -06:00
Jonas
f7762ae91d support geometry type LinearRing (#1432)
* support geometry type LinearRing

* fix bugs in test_is_valid_geom_ring
2018-07-31 17:10:22 -06:00
Sean C. Gillies
43d3f7b4f0 Remove xfail marker, address other feedback
Also a little test cleanup
2018-05-15 11:33:35 -06:00
Sean C. Gillies
12f15ff51c Remove all deprecated features* and update tests
*except reading from datasets in "w" mode, which will wait one
more pre-release or two.
2018-04-13 16:43:26 -06:00
Andrew Catellier
2b9eb086ae add tests for dataset rotation 2018-02-15 16:40:14 -07:00
Brendan Ward
a9e8821b7d Merge branch 'master' into issue1253 2018-02-07 20:33:26 -05:00
Brendan Ward
3c205cf9ee Flatten GeometryCollection to individual parts before rasterize 2018-02-07 20:30:52 -05:00
Brendan Ward
870cdd62f7 Add tests for __geo_interface__ for bounds and raster_geometry_mask 2018-02-05 05:35:53 -08:00
Brendan Ward
5f1eaa869b XFailing test for gdal geometrycollection rasterize bug 2018-02-03 17:59:32 -08:00
Brendan Ward
eca50a816e Use enum for rasterize merge algorithm 2018-01-10 20:58:46 -08:00
Brendan Ward
fded0b1d44 Converted a few test xfails to skip, dropped or modified a few others 2017-11-30 20:13:16 -08:00
Frédéric Bonifas
d913a39579 change the rasterize option merge_alg_add to merge_alg 2017-11-13 18:00:59 +01:00
Frédéric Bonifas
095f649532 test the merge_alg_add option of rasterize 2017-11-08 14:13:55 +01:00
Brendan Ward
8971e0ffc6 Additional validation and test of rasterize 2017-11-04 13:55:28 -07:00
Brendan Ward
c542992631 raise error on invalid shape for InMemoryRaster, and associated tests 2017-11-04 13:26:25 -07:00
Brendan Ward
79062b42a1 Prevent segfaults in rasterize (#1176)
* Add better check for GeoJSON inputs to rasterize and associated tests
* Restructured OGRGeomBuilder to avoid segfault
2017-10-19 06:48:45 -07:00
Brendan Ward
c54e22da24 Raise WindowError from geometry_window 2017-09-19 19:34:21 -07:00
Brendan Ward
330574fd90 Refactored mask functionality, updated tests 2017-09-11 20:59:02 -07:00
Kevin Wurster
e5b72e522d Remove unnecessary 'rasterio.Env()' calls. 2017-04-13 19:35:41 -04:00
Matthew Perry
9fa708269b enforce that out_shape is 2D 2016-08-15 18:27:36 -04:00
Erik Seglem
44c3d9badf Replace drivers with Env in docs and examples (#760)
Replace rasterio.drivers with rasterio.Env.
2016-06-02 19:01:18 -07:00
Erik Seglem
a31e3c8c16 Standardize on import numpy as np. 2016-06-01 22:47:33 -04:00
Sean Gillies
12f8fc7e3f New, lazier AWS sessions
New Env class and tests.
More logging, tests, safer environment
Remove usage (deprecated) of rasterio.drivers()
Also pep8 cleanups throughout the tests and a fix for unchecked
dtypes when opening a dataset in 'w' mode.
Now we can simply import warnings in __init__.py. In the
deprecations tests, we needed to see a single warning only one
time to avoid multiple drivers() warnings.
Add a global env.
Add rasterio.env.setenv()
2016-04-28 15:26:55 -06:00