- Update the links for NLDI and PyGeoAPI web services to the latest addresses.
- Fix a bug in
WFS.getfeature_bygeom
where if the input geometry is in a geographic CRS, the function fails to transform it correctly to the web service's CRS.
- Drop support for Python 3.8 since its end-of-life date is October 2024.
- Remove all exceptions from the main module and raise them from the
exceptions
module. This is to declutter the public API and make it easier to maintain.
- Update the links for FEMA web services to the latest addresses.
- When the CRS of a WMS cannot be parsed throw a more informative error regarding the service being down (:issue_hydro:`122`).
- Drop support for Python 3.8 since its end-of-life date is October 2024.
- Make
streaming_download
more robust when encoutring request issues by returningNone
for those links that have failed to be processed, instead of throwing exceptions. So, for example, if only one link fails, the function will return a list of paths withNone
for the failed link. - In all requests by geometries, set the geometry precision to 6 decimal points to avoid issues with large decimal points.
- Add the
exceptions
module to the high-level API to declutter the main module. In the future, all exceptions will be raised from this module and not from the main module. For now, the exceptions are raised from both modules for backward compatibility.
- Remove the deprecated AirMap URL.
pyproj
uses its own env variables for SSL certification. This release fixes the issue withpyproj
not being able to download the grid database when using DOI SSL certification file. This release usespyproj.network.set_ca_bundle_path
for setting the SSL certification file given by the user viaHYRIVER_SSL_CERT
env variable.- Fix an issue in
WFS.getfeature_byid
where themax_nrecords
argument was not being used correctly, thus resulting in large requests to fail.
- For
ServiceURL
class, usedataclass
instead for better performance and consistency.
- Add a new arg to
WMS.getmap_bybox
calledtiff_dir
for storing the responses from a WMS request as a GeoTIFF file on disk instead of keeping all responses in memory. When this arg is given the function return a list of paths to these files. This is useful for large requests where the response is too large to be kept in memory. You can create a VRT file from these files usingpygeoutils.gtiff2vrt
function.
- Added RESTfulURLs for FEMA's National Flood Hazard Layer (NFHL) service. Contributed by Fernando Aristizabal. (:pull_ogc:`62`)
- Now,
RetrySession
can be used as a context manager. This is useful for closing the session after using it. For example:
from pygeoogc import RetrySession
with RetrySession() as session:
r = session.get("https://httpbin.org/get").json()
- Improve the example in the docstring of
traverse_json
function. - Improve exception handling in the
ArcGISRESTful
class and return a more informative error message.
From release 0.15 onward, all minor versions of HyRiver packages
will be pinned. This ensures that previous minor versions of HyRiver
packages cannot be installed with later minor releases. For example,
if you have pygeoogc==0.14.x
installed, you cannot install
pygeoogc==0.15.x
series. This is to ensure that the API is
consistent across all minor versions.
- Add the STN Flood Event Data URL to the list of RESTfuls. Contributed by Fernando Aristizabal. (:pull_ogc:`59`)
- Add the link for the eHydro's web service.
From release 0.15 onward, all minor versions of HyRiver packages
will be pinned. This ensures that previous minor versions of HyRiver
packages cannot be installed with later minor releases. For example,
if you have pygeoogc==0.14.x
installed, you cannot install
pygeoogc==0.15.x
series. This is to ensure that the API is
consistent across all minor versions.
- For now, retain compatibility with
shapely<2
while supportingshapley>=2
.
- Fix an issue in
WFS
where thegetfeature_bygeom
method fails if the requested web service does not havegeometry_column
attribute in its schema. This release addresses this issue by trying to find the name from other attributes in the schema. If it fails to find, it raises aValueError
. - Catch an edge case in
match_crs
function where the input is a list of coordinates of length 4. - Give precedence to non-default arguments for caching related arguments instead of directly getting them from env variables. This is to avoid the case where the user sets the env variables but then passes different arguments to the function. In this case, the function should use the passed arguments instead of the env variables.
- Remove
pyyaml
as a dependency since it is not used anymore.
- Bump the minimum required version of
shapely
to 2.0, and use its new API.
- Sync all minor versions of HyRiver packages to 0.14.0.
- Make
match_crs
less strict in terms of the input geometry type beingtuple
orlist
by relying onshapely
andcontextlib.suppress
. So, now users can pass any combination oflist
ortuple
as coordinates or bounding box. - More robust handling of inputs and outputs in
streaming_download
. Now, only if input isstr
the function returns a singlePath
object. Previously if there was only one URL, whetherlist
of length one orstr
, the output was a singlePath
, which could have had unintended consequences.
- In
WFS
when some layers have missing schema info, the class failed to initialize. This release fixes this issue by ignoring layers with missing schema info and asks the user to pass a sort parameter instead of trying to automatically find a sort parameter. This fix also improves the performance of this function by making fewer web requests.
- Fully migrate
setup.cfg
andsetup.py
topyproject.toml
. - Convert relative imports to absolute with
absolufy-imports
. - Sync all patch versions of HyRiver packages to x.x.12.
- Remove all Python 3.9 type-annotation-style in the codebase except for function signatures to ensure compatibility with Python 3.8. (:issue_ogc:`57`, :pull_ogc:`58`). Thanks to Tim Cera for reporting and fixing the issue.
- Use
pyright
for type checking instead ofmypy
since it is faster and more accurate. Also, fix all the type errors reported bypyright
. - Improve code quality by addressing issues raised by DeepSource.
- Add the missing annotation import to the
cache_keys
to ensure Python 3.8 and 3.9 work with Python 3.10 style type hinting.
- Add a new property to
WFS
class calledschema
that contains information about column names and their types for all layers. It also the geometry type and its name for each layer. - Automatically determine the geometry keyword that should be passed to
WFS.getfeature_bygeom
using the newschema
property ofWFS
. - Add support for disabling SSL verification to
RetrySession
viassl
parameter. - Add support for streaming responses to
RetrySession
viastream
parameter toget
andpost
methods. - Add support for closing the session to
RetrySession
viaclose
method. - Add support for passing
params
,data
, andjson
toRetrySession
viaget
andpost
methods. Previously, keywordpayload
was used forparams
inget
anddata
inpost
. Now,params
anddata
can also be passed as keyword arguments to these methods. - Add a new function called
streaming_download
for downloading large files in parallel and in chunks.
- Fix an issue in
WFS
class where number of requested features exceeds the maximum number of features allowed by the server, but only a portion of the features are returned. This release addresses this issue by first getting only the number of features and then requesting the features in chunks of features IDs based on the maximum number of features allowed by the server.
- Drop support for WFS version 1.0.0 since it does not support paging.
- Modify the codebase based on Refurb suggestions.
- Fix the warning message in
ArcGISRESTFul
where wrong number of missing feature IDs were being reported.
- Add a new method to
RetrySession
for getting the request head calledRetrySession.head
. This is useful for getting the headers of a request without having to make a full request which is useful for getting theContent-Length
header for example, i.e., download size.
- Fix an issue in the decompose function,
utils.bbox_decompose
, where the generated bounding boxes might overlap in some cases. A new approach has been implemented based on finding the number of required bounding boxes from max allowable no. of pixels and total requested pixels without changing the input bounding box projection. This ensures that the decomposed bounding boxes are not overlapping soxarray.open_mfdataset
can be used without any issues.
- In the
utils.match_crs
function, don't perform any projection if the source target CRS are the same. - Improve type hints for CRS-related arguments of all functions by including string,
integer, and
pyproj.CRS
types. - Add a new class method to
WMSBase
andWFSBase
classes calledget_service_options
for retrieving the available layers, output formats, and CRSs for a given service. Here's an example: - Use
pyupgrade
package to update the type hinting annotations to Python 3.10 style.
from pygeoogc.core import WMSBase
url = "https://elevation.nationalmap.gov/arcgis/services/3DEPElevation/ImageServer/WMSServer"
wms = WMSBase(url, validation=False)
wms.get_service_options()
print(wms.available_layer)
- Add the missing PyPi classifiers for the supported Python versions.
- Append "Error" to all exception classes for conforming to PEP-8 naming conventions.
- Bump minimum version of
owslib
to 0.27.2 since thepyproj
incompatibility issue has been addressed in this issue. - Bump minimum version of
requests-cache
to 0.9.6 since theattrs
version issue has been addressed.
- Add support for disabling persistent caching in
RetrySession
via an argument and alsoHYRIVER_CACHE_DISABLE
environmental variable.
- Set the minimum supported version of Python to 3.8 since many of the
dependencies such as
xarray
,pandas
,rioxarray
have dropped support for Python 3.7. - Pin
owslib
to version <0.26 since version 0.26 has pinnedpyproj
to version <3.3 which is not compatible withrasterio
on macOS.
- Use micromamba for running tests and use nox for linting in CI.
- More robust handling of errors in
ArcGISRESTful
by catchingNone
responses. Also, use thePOST
method forArcGISRESTful.bysql
since the SQL Clause could be a long string.
Remove caching-related arguments from all functions since now they can be set globally via three environmental variables:
HYRIVER_CACHE_NAME
: Path to the caching SQLite database.HYRIVER_CACHE_EXPIRE
: Expiration time for cached requests in seconds.HYRIVER_CACHE_DISABLE
: Disable reading/writing from/to the cache file.
You can do this like so:
import os
os.environ["HYRIVER_CACHE_NAME"] = "path/to/file.sqlite"
os.environ["HYRIVER_CACHE_EXPIRE"] = "3600"
os.environ["HYRIVER_CACHE_DISABLE"] = "true"
- In
ArcGISRESTful.oids_byfield
convert the inputids
to alist
if a user passes a singleid
.
- Refactor
ServicURL
to hard code the supported links instead of reading them from a file. Also, the class now is based onNamedTuple
that has a nicer__repr__
.
- Make
validate_crs
public that can be accessed from theutils
module. This is useful for checking validity of user input CRS values and getting its string representation. - Add
pygeoogc.utils.valid_wms_crs
function for getting a list of valid CRS values from a WMS service. - Add 3DEP's index WFS service for querying availability of 3DEP data within a bounding box.
- Add type checking with
typeguard
and fixed typing issues raised bytypeguard
. - Refactor
show_versions
to ensure getting correct versions of all dependencies.
- Use the three new
ar.retrieve_*
functions instead of the oldar.retrieve
function to improve type hinting and to make the API more consistent.
- Add a new argument to
ArcGISRESTful
calledverbose
to turn on/off all info level logs. - Add an option to
ArcGISRESTful.get_features
calledget_geometry
to turn on/off requesting the data with or without geometry. - Now,
ArcGISRESTful
saves the object IDs of the features that user requested but are not available in the database to./cache/failed_request_ids.txt
. - Add a new parameter to
ArcGISRESTful
calleddisable_retry
that IfTrue
in case there are any failed queries, no retrying attempts is done and object IDs of the failed requests are saved to a text file which its path can be accessed viaArcGISRESTful.client.failed_path
. - Set response caching expiration time to never expire, for all base classes. A new argument
has been added to all three base classes called
expire_after
that can be used to set the expiration time. - Add a new method to all three base classes called
clear_cache
that clears all cached responses for that specific client.
- All
oids_by*
methods ofArcGISRESTful
class now return a list of object IDs rather than settingself.featureids
. This makes it possible to pass the outputs of theoids_by*
functions directly to theget_features
method.
- Make
ArcGISRESTful
less cluttered by instantiatingArcGISRESTfulBase
in theinit
method ofArcGISRESTful
rather than inheriting from its base class. - Explicitly set a minimum value of 1 for the maximum number of feature IDs per request
in
ArcGISRESTful
, i.e.,self.max_nrecords
. - Add all the missing types so
mypy --strict
passes.
- Remove the
onlyipv4
method fromRetrySession
since it can be easily be achieved usingwith unittest.mock.patch("socket.has_ipv6", False):
.
- Use the
geoms
method for iterating over geometries to address the deprecation warning ofshapely
. - Use
importlib-metadata
for getting the version instead ofpkg_resources
to decrease import time as discussed in this issue. - Remove unnecessary dependency on
simplejson
and useujson
instead.
- Update the code to use the latest
requsts-cache
API.
- Add URL for PyGeoAPI service.
- Fix a bug in
WFS.getfeature_byid
when the number of IDs exceeds the service's limit by splitting large requests into multiple smaller requests. - Add two new arguments,
max_nrecords
andread_method
, toWFS
to control the maximum number of records per request (defaults to 1000) and specify the response read method (defaults tojson
), respectively.
- Simplify the retry logic
ArcGISRESTFul
by making it run four times and making sure that the last retry is one object ID per request.
The highlight of this release is migrating to use AsyncRetriever
that can improve
the network response time significantly. Another highlight is a major refactoring of
ArcGISRESTFul
that improves performance and reduce code complexity.
- Add a new method to
ArcGISRESTFul
class for automatically retrying the failed requests. This private method plucks out individual features that were in a failed request with several features. This happens when there are some object IDs that are not available on the server, and they are included in the request. In these situations the request will fail, although there are valid object IDs in the request. This method will pluck out the valid object IDs. - Add support for passing additional parameters to
WMS
requests such asstyles
. - Add support for WFS version 1.0.0.
- Migrate to
AsyncRetriever
fromrequests-cache
for all the web services. - Rename
ServiceError
toServiceUnavailable
andServerError
toServiceError
Since it's more representative of the intended exception. - Raise for response status in
RetrySession
before the try-except block soRequestsException
can raise, and its error messaged be parsed. - Deprecate
utils.threading
since all threading operations are now handled byAsyncRetriever
. - Increase test coverage.
- Add support for requesting
LineString
polygon forArcGISRESTful
. - Add a new argument called
distance
toArcGISRESTful.oids_bygeom
for specifying the buffer distance from the input geometry for getting features.
- Drop support for Python 3.6 since many of the dependencies such as
xarray
andpandas
have done so. - Remove
async_requests
function, since it has been packaged as a new Python library called AsyncRetriever. - Refactor
MatchCRS
. Now, it should be instantiated by providing the in and out CRSs like so:MatchCRS(in_crs, out_crs)
. Then its methods, namely,geometry
,bounds
andcoords
, can be called. These methods now have only one input, geometry. - Change input and output types of
MatchCRS.coords
from tuple of lists of coordinates to list of(x, y)
coordinates. ArcGISRESTful
now has a new argument,layer
, for specifying the layer number (int). Now, the target layer should either be a part ofbase_url
or be passed withlayer
argument.- Move the
spatial_relation
argument fromArcGISRESTful
class tooids_bygeom
method, since that's where it's applicable.
- Refactor
ArcGISRESTfulBase
class to reduce its code complexity and make the service initialization logic much simpler. The class is faster since it makes fewer requests during the initialization process. - Add
pydantic
as a new dependency that takes care ofArcGISRESTfulBase
validation. - Use persistent caching for all send/receive requests that can significantly improve the network response time.
- Explicitly include all the hard dependencies in
setup.cfg
. - Set a default value of 1000 for
max_nrecords
inArcGISRESTfulBase
. - Use
dataclass
forWMSBase
andWFSBase
since support for Python 3.6 is dropped.
- Add announcement regarding the new name for the software stack, HyRiver.
- Improve
pip
installation and release workflow.
- The first release after renaming
hydrodata
toPyGeoHydro
. - Fix
extent
property ofArcGISRESTful
being set toNone
incorrectly. - Add
feature types
property toArcGISRESTFul
for getting names and IDs of types of features in the database. - Replace
cElementTree
withElementTree
since it's been deprecated bydefusedxml
. - Remove dependency on
dataclasses
since its benefits and usage in the code was minimal. - Speed up CI testing by using
mamba
and caching. ArcGISRESTFull
now prints number of found features before attempting to retrieve them.- Use
logging
module for printing information.
- Bump version to the same version as PyGeoHydro.
- Add support for query by point and multi-points to
ArcGISRESTful.bygeom
. - Add support for buffer distance to
ArcGISRESTful.bygeom
. - Add support for generating ESRI-based queries for points and multi-points
to
ESRIGeomQuery
. - Add all the missing type annotations.
- Update the Daymet URL to version 4. You can check the release information here
- Use
cytoolz
library for improving performance of some operations. - Add
extent
property toArcGISRESTful
class that get the spatial extent of the service. - Add URL to
airmap
service for getting elevation data at 30 m resolution.
- Fix
urlib3
deprecation warning about usingmethod_whitelist
.
- Remove unused variables in
async_requests
and usemax_workers
. - Fix the
async_requests
issue on Windows systems.
- Added/Renamed three class methods in
ArcGISRESTful
:oids_bygeom
,oids_byfield
, andoids_bysql
. So you can query feature within a geometry, using specific field ID(s), or more generally using any valid SQL 92 WHERE clause. - Added support for query with SQL WHERE clause to
ArcGISRESTful
. - Changed the NLDI's URL for migrating to its new API v3.
- Added support for CQL filter to
WFS
, credits to Emilio. - Moved all the web services URLs to a YAML file that
ServiceURL
class reads. It makes managing the new URLs easier. The file is located atpygeoogc/static/urls.yml
. - Turned off threading by default for all the services since not all web services supports it.
- Added support for setting the request method,
GET
orPOST
, forWFS.byfilter
, which could be useful when the filter string is long. - Added support for asynchronous download via the function
async_requests
.
- Improved
bbox_decompose
to fix theWMS
issue with high resolution requests. - Replaces
simplejson
withorjson
to speed up JSON operations.
- Removed threading for
WMS
due to inconsistent behavior. - Addressed an issue with domain decomposition for
WMS
where width/height becomes 0.
- Renamed
vsplit_bbox
tobbox_decompose
. The function now decomposes the domain in both directions and return squares and rectangular.
- Re-wrote
wms_bybox
function as a class calledWMS
with a similar interface to theWFS
class. - Added support for WMS 1.3.0 and WFS 2.0.0.
- Added a custom
Exception
for the threading function calledThreadingException
. - Add
always_xy
flag toWMS
andWFS
which is False by default. It is useful for cases where a web service doesn't change the axis order from the transitionalxy
toyx
for versions higher than 1.3.0.
- Remove unnecessary transformation of the input bbox in WFS.
- Use
setuptools_scm
for versioning.
- Add the missing
max_pixel
argument to thewms_bybox
function. - Change the
onlyIPv4
method ofRetrySession
class toonlyipv4
to conform to thesnake_case
convention. - Improve docstrings.
- Initial release.