diff --git a/README.md b/README.md index f9551f5..43ce160 100644 --- a/README.md +++ b/README.md @@ -131,12 +131,12 @@ time = pandas.date_range("2018-01-01", periods=3, freq="M") ## Contribution Guidelines -The easiest way to contribute is to file a comprehensive [issue](https://github.com/GIScience/ohsome-py/issues) with a reproducible example. Pull requests are always welcome, so if you want to contribute to this project, please fork the repository or create a new branch containing your changes. - -This package uses [poetry](https://python-poetry.org/) for dependency management. +The easiest way to contribute is to file a comprehensive [issue](https://github.com/GIScience/ohsome-py/issues) with a reproducible example. Pull requests are always welcome, so if you want to contribute to this project, please fork the repository or create a new branch containing your changes. Follow the steps below to make sure that your contributed code follows the code style and does not break any functionality. Create a **pull request to the main/master** branch once it is ready to be merged. ### Install Package +This package uses [poetry](https://python-poetry.org/) for dependency management. To install all packages necessary for testing and development run + `poetry install` ### Install Pre-Commit Hooks @@ -147,12 +147,10 @@ This package uses [poetry](https://python-poetry.org/) for dependency management ### Run Tests -**Before pushing your commits**, run python tests +**Before pushing your commits**, run the python unit tests `poetry run pytest` -Create a **pull request to the main/master** branch once it is ready to be merged. - #### VCR ohsome-py records responses using [VCR](https://vcrpy.readthedocs.io/en/latest/) via [pytest-recording](https://github.com/kiwicom/pytest-recording) to prevent unnecessary network traffic and computing during testing. If you implement a test or change an existing one, make sure to update the recorded cassettes. In addition, you should delete all cassettes after a certain time (e.g. every 6m or on each new ohsome release) and re-record them. To do that run diff --git a/ohsome/clients.py b/ohsome/clients.py index 7358324..995147a 100644 --- a/ohsome/clients.py +++ b/ohsome/clients.py @@ -740,10 +740,30 @@ def count(self): class _OhsomeClientContributionsAggregated(_OhsomePostClient): @property def density(self): - return _OhsomePostClient( + return _OhsomeClientContributionsAggregatedDensity( self._base_api_url, self.log, self.log_dir, self._cache + ["density"] ) + @property + def groupByBoundary(self): + return _OhsomePostClient( + self._base_api_url, + self.log, + self.log_dir, + self._cache + ["groupBy", "boundary"], + ) + + +class _OhsomeClientContributionsAggregatedDensity(_OhsomePostClient): + @property + def groupByBoundary(self): + return _OhsomePostClient( + self._base_api_url, + self.log, + self.log_dir, + self._cache + ["groupBy", "boundary"], + ) + class _OhsomeClientContributionsLatest(_OhsomePostClient): """Subclass of _OhsomePostClient to define endpoints of ohsome API for contribution analyses.""" @@ -766,6 +786,12 @@ def geometry(self): self._base_api_url, self.log, self.log_dir, self._cache + ["geometry"] ) + @property + def count(self): + return _OhsomeClientContributionsAggregated( + self._base_api_url, self.log, self.log_dir, self._cache + ["count"] + ) + class _OhsomeClientUsers(_OhsomeBaseClient): """Subclass of _OhsomePostClient to define endpoints of ohsome API""" diff --git a/ohsome/test/cassettes/test_client/test_check_time_parameter_datetime.yaml b/ohsome/test/cassettes/test_client/test_check_time_parameter_datetime.yaml index 6d54c8d..b5d55ae 100644 --- a/ohsome/test/cassettes/test_client/test_check_time_parameter_datetime.yaml +++ b/ohsome/test/cassettes/test_client/test_check_time_parameter_datetime.yaml @@ -43,7 +43,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:48 GMT + - Wed, 29 Nov 2023 14:33:51 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_check_time_parameter_list.yaml b/ohsome/test/cassettes/test_client/test_check_time_parameter_list.yaml index 8525244..c9b22b6 100644 --- a/ohsome/test/cassettes/test_client/test_check_time_parameter_list.yaml +++ b/ohsome/test/cassettes/test_client/test_check_time_parameter_list.yaml @@ -44,7 +44,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:48 GMT + - Wed, 29 Nov 2023 14:33:51 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_end_timestamp_as_time_input.yaml b/ohsome/test/cassettes/test_client/test_end_timestamp_as_time_input.yaml index c84f37e..89c2341 100644 --- a/ohsome/test/cassettes/test_client/test_end_timestamp_as_time_input.yaml +++ b/ohsome/test/cassettes/test_client/test_end_timestamp_as_time_input.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:48 GMT + - Wed, 29 Nov 2023 14:33:53 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bboxes_dataframe.yaml b/ohsome/test/cassettes/test_client/test_format_bboxes_dataframe.yaml index 538ad3f..a9b8109 100644 --- a/ohsome/test/cassettes/test_client/test_format_bboxes_dataframe.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bboxes_dataframe.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:53 GMT + - Wed, 29 Nov 2023 14:33:55 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bboxes_list.yaml b/ohsome/test/cassettes/test_client/test_format_bboxes_list.yaml index ea02d0b..29947c0 100644 --- a/ohsome/test/cassettes/test_client/test_format_bboxes_list.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bboxes_list.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:53 GMT + - Wed, 29 Nov 2023 14:33:57 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -99,7 +99,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:53 GMT + - Wed, 29 Nov 2023 14:33:57 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -156,7 +156,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:55 GMT + - Wed, 29 Nov 2023 14:33:57 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -213,7 +213,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:55 GMT + - Wed, 29 Nov 2023 14:33:58 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -270,7 +270,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:55 GMT + - Wed, 29 Nov 2023 14:33:58 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bcircles_dataframe.yaml b/ohsome/test/cassettes/test_client/test_format_bcircles_dataframe.yaml index e6d3721..389e75a 100644 --- a/ohsome/test/cassettes/test_client/test_format_bcircles_dataframe.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bcircles_dataframe.yaml @@ -45,7 +45,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:49 GMT + - Wed, 29 Nov 2023 14:33:53 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bcircles_list.yaml b/ohsome/test/cassettes/test_client/test_format_bcircles_list.yaml index 29e8819..d9fa089 100644 --- a/ohsome/test/cassettes/test_client/test_format_bcircles_list.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bcircles_list.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:51 GMT + - Wed, 29 Nov 2023 14:33:53 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -102,7 +102,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:51 GMT + - Wed, 29 Nov 2023 14:33:54 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -159,7 +159,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:51 GMT + - Wed, 29 Nov 2023 14:33:54 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -216,7 +216,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:52 GMT + - Wed, 29 Nov 2023 14:33:54 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bcircles_pandas.yaml b/ohsome/test/cassettes/test_client/test_format_bcircles_pandas.yaml index 80c3b1c..2de2a57 100644 --- a/ohsome/test/cassettes/test_client/test_format_bcircles_pandas.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bcircles_pandas.yaml @@ -51,7 +51,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:52 GMT + - Wed, 29 Nov 2023 14:33:55 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_format_bpolys.yaml b/ohsome/test/cassettes/test_client/test_format_bpolys.yaml index 1d62be3..32d3d07 100644 --- a/ohsome/test/cassettes/test_client/test_format_bpolys.yaml +++ b/ohsome/test/cassettes/test_client/test_format_bpolys.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:52 GMT + - Wed, 29 Nov 2023 14:33:55 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_post_with_endpoint_string.yaml b/ohsome/test/cassettes/test_client/test_post_with_endpoint_string.yaml index ccea8c5..c235a52 100644 --- a/ohsome/test/cassettes/test_client/test_post_with_endpoint_string.yaml +++ b/ohsome/test/cassettes/test_client/test_post_with_endpoint_string.yaml @@ -50,7 +50,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:54:56 GMT + - Wed, 29 Nov 2023 14:33:58 GMT Keep-Alive: - timeout=5, max=100 Server: @@ -115,7 +115,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:54:56 GMT + - Wed, 29 Nov 2023 14:34:00 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_client/test_user_agent.yaml b/ohsome/test/cassettes/test_client/test_user_agent.yaml index f6d09fd..9f15c66 100644 --- a/ohsome/test/cassettes/test_client/test_user_agent.yaml +++ b/ohsome/test/cassettes/test_client/test_user_agent.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:44 GMT + - Wed, 29 Nov 2023 14:33:51 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_exceptions/test_disable_logging.yaml b/ohsome/test/cassettes/test_exceptions/test_disable_logging.yaml index 7284a22..f3bd938 100644 --- a/ohsome/test/cassettes/test_exceptions/test_disable_logging.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_disable_logging.yaml @@ -18,7 +18,7 @@ interactions: uri: https://api.ohsome.org/v1/elements/geometry response: body: - string: "{\n \"timestamp\" : \"2023-11-29T13:54:57.479125767\",\n \"status\" + string: "{\n \"timestamp\" : \"2023-11-29T14:34:00.391089847\",\n \"status\" : 413,\n \"message\" : \"The given query is too large in respect to the given timeout. Please use a smaller region and/or coarser time period.\",\n \"requestUrl\" : \"https://api.ohsome.org/v1/elements/geometry\"\n}" @@ -44,7 +44,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:54:56 GMT + - Wed, 29 Nov 2023 14:34:00 GMT Server: - Apache Strict-Transport-Security: diff --git a/ohsome/test/cassettes/test_exceptions/test_exception_connection_reset.yaml b/ohsome/test/cassettes/test_exceptions/test_exception_connection_reset.yaml index 3ce90fe..2417600 100644 --- a/ohsome/test/cassettes/test_exceptions/test_exception_connection_reset.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_exception_connection_reset.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:14 GMT + - Wed, 29 Nov 2023 14:34:06 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_exceptions/test_exception_invalid_parameters.yaml b/ohsome/test/cassettes/test_exceptions/test_exception_invalid_parameters.yaml index 1df0927..3ae975b 100644 --- a/ohsome/test/cassettes/test_exceptions/test_exception_invalid_parameters.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_exception_invalid_parameters.yaml @@ -18,7 +18,7 @@ interactions: uri: https://api.ohsome.org/v1/elements/count/groupBy/tag response: body: - string: "{\n \"timestamp\" : \"2023-11-29T13:55:14.60175905\",\n \"status\" + string: "{\n \"timestamp\" : \"2023-11-29T14:34:06.847865564\",\n \"status\" : 400,\n \"message\" : \"You need to give one groupByKey parameter, if you want to use groupBy/tag.\",\n \"requestUrl\" : \"https://api.ohsome.org/v1/elements/count/groupBy/tag\"\n}" headers: @@ -41,7 +41,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:14 GMT + - Wed, 29 Nov 2023 14:34:06 GMT Server: - Apache Strict-Transport-Security: diff --git a/ohsome/test/cassettes/test_exceptions/test_invalid_url.yaml b/ohsome/test/cassettes/test_exceptions/test_invalid_url.yaml index 6b5fede..2066a75 100644 --- a/ohsome/test/cassettes/test_exceptions/test_invalid_url.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_invalid_url.yaml @@ -38,7 +38,7 @@ interactions: Content-Type: - text/html Date: - - Wed, 29 Nov 2023 13:54:57 GMT + - Wed, 29 Nov 2023 14:34:00 GMT ETag: - '"25c-5c7180820e5fc"' Keep-Alive: diff --git a/ohsome/test/cassettes/test_exceptions/test_log_bpolys.yaml b/ohsome/test/cassettes/test_exceptions/test_log_bpolys.yaml index ec243e6..a25b5d5 100644 --- a/ohsome/test/cassettes/test_exceptions/test_log_bpolys.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_log_bpolys.yaml @@ -18,7 +18,7 @@ interactions: uri: https://api.ohsome.org/v1/elements/count response: body: - string: "{\n \"timestamp\" : \"2023-11-29T13:54:57.656277775\",\n \"status\" + string: "{\n \"timestamp\" : \"2023-11-29T14:34:00.551018719\",\n \"status\" : 413,\n \"message\" : \"The given query is too large in respect to the given timeout. Please use a smaller region and/or coarser time period.\",\n \"requestUrl\" : \"https://api.ohsome.org/v1/elements/count\"\n}" @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:57 GMT + - Wed, 29 Nov 2023 14:34:00 GMT Server: - Apache Strict-Transport-Security: diff --git a/ohsome/test/cassettes/test_exceptions/test_log_curl.yaml b/ohsome/test/cassettes/test_exceptions/test_log_curl.yaml index 1b1de46..ece140b 100644 --- a/ohsome/test/cassettes/test_exceptions/test_log_curl.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_log_curl.yaml @@ -18,7 +18,7 @@ interactions: uri: https://api.ohsome.org/v1/elements/count response: body: - string: "{\n \"timestamp\" : \"2023-11-29T13:54:57.759114624\",\n \"status\" + string: "{\n \"timestamp\" : \"2023-11-29T14:34:00.706669081\",\n \"status\" : 413,\n \"message\" : \"The given query is too large in respect to the given timeout. Please use a smaller region and/or coarser time period.\",\n \"requestUrl\" : \"https://api.ohsome.org/v1/elements/count\"\n}" @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:54:57 GMT + - Wed, 29 Nov 2023 14:34:00 GMT Server: - Apache Strict-Transport-Security: diff --git a/ohsome/test/cassettes/test_exceptions/test_timeout_error.yaml b/ohsome/test/cassettes/test_exceptions/test_timeout_error.yaml index f36d240..165a29d 100644 --- a/ohsome/test/cassettes/test_exceptions/test_timeout_error.yaml +++ b/ohsome/test/cassettes/test_exceptions/test_timeout_error.yaml @@ -18,7 +18,7 @@ interactions: uri: https://api.ohsome.org/v1/elements/geometry response: body: - string: "{\n \"timestamp\" : \"2023-11-29T13:54:57.300350483\",\n \"status\" + string: "{\n \"timestamp\" : \"2023-11-29T14:34:00.219799634\",\n \"status\" : 413,\n \"message\" : \"The given query is too large in respect to the given timeout. Please use a smaller region and/or coarser time period.\",\n \"requestUrl\" : \"https://api.ohsome.org/v1/elements/geometry\"\n}" @@ -44,7 +44,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:54:56 GMT + - Wed, 29 Nov 2023 14:34:00 GMT Server: - Apache Strict-Transport-Security: diff --git a/ohsome/test/cassettes/test_response/test_contributions_centroid.yaml b/ohsome/test/cassettes/test_response/test_contributions_centroid.yaml index 1124c3f..efa7263 100644 --- a/ohsome/test/cassettes/test_response/test_contributions_centroid.yaml +++ b/ohsome/test/cassettes/test_response/test_contributions_centroid.yaml @@ -46,7 +46,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:55:21 GMT + - Wed, 29 Nov 2023 14:34:15 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_contributions_count_density_groupbyboundary.yaml b/ohsome/test/cassettes/test_response/test_contributions_count_density_groupbyboundary.yaml new file mode 100644 index 0000000..2f5ec67 --- /dev/null +++ b/ohsome/test/cassettes/test_response/test_contributions_count_density_groupbyboundary.yaml @@ -0,0 +1,61 @@ +interactions: +- request: + body: bboxes=8.7137%2C49.4096%2C8.717%2C49.4119&time=2015-01-01%2C2016-01-01&filter=name%3DKrautturm+and+type%3Away + headers: + Accept: + - '*/*' + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '109' + Content-Type: + - application/x-www-form-urlencoded + user-agent: + - ohsome-py/0.2.0 + method: POST + uri: https://api.ohsome.org/v1/contributions/count/density/groupBy/boundary + response: + body: + string: "{\n \"attribution\" : {\n \"url\" : \"https://ohsome.org/copyrights\",\n + \ \"text\" : \"\xA9 OpenStreetMap contributors\"\n },\n \"apiVersion\" + : \"1.10.1\",\n \"groupByResult\" : [ {\n \"groupByObject\" : \"boundary1\",\n + \ \"result\" : [ {\n \"fromTimestamp\" : \"2015-01-01T00:00:00Z\",\n + \ \"toTimestamp\" : \"2016-01-01T00:00:00Z\",\n \"value\" : 16.32\n + \ } ]\n } ]\n}" + headers: + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Headers: + - Origin,Accept,X-Requested-With,Content-Type,Access-Control-Request-Method,Access-Control-Request-Headers,Authorization + Access-Control-Allow-Methods: + - POST, GET + Access-Control-Allow-Origin: + - '*' + Access-Control-Max-Age: + - '3600' + Cache-Control: + - no-transform, public, max-age=31556926 + Connection: + - Keep-Alive + Content-Encoding: + - gzip + Content-Type: + - application/json + Date: + - Wed, 29 Nov 2023 14:34:15 GMT + Keep-Alive: + - timeout=5, max=100 + Server: + - Apache + Strict-Transport-Security: + - max-age=63072000; includeSubdomains; + Transfer-Encoding: + - chunked + vary: + - accept-encoding + status: + code: 200 + message: '' +version: 1 diff --git a/ohsome/test/cassettes/test_response/test_contributions_latest.yaml b/ohsome/test/cassettes/test_response/test_contributions_latest.yaml index 081d514..dcec75d 100644 --- a/ohsome/test/cassettes/test_response/test_contributions_latest.yaml +++ b/ohsome/test/cassettes/test_response/test_contributions_latest.yaml @@ -50,7 +50,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:55:23 GMT + - Wed, 29 Nov 2023 14:34:16 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elementsFullHistory_geometry.yaml b/ohsome/test/cassettes/test_response/test_elementsFullHistory_geometry.yaml index a5e5687..a03718b 100644 --- a/ohsome/test/cassettes/test_response/test_elementsFullHistory_geometry.yaml +++ b/ohsome/test/cassettes/test_response/test_elementsFullHistory_geometry.yaml @@ -50,7 +50,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:55:21 GMT + - Wed, 29 Nov 2023 14:34:13 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count.yaml b/ohsome/test/cassettes/test_response/test_elements_count.yaml index e3dfede..2e69b13 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:14 GMT + - Wed, 29 Nov 2023 14:34:06 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary.yaml b/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary.yaml index d695c6b..9672918 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary.yaml @@ -45,7 +45,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:18 GMT + - Wed, 29 Nov 2023 14:34:11 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary_groupby_tag.yaml b/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary_groupby_tag.yaml index 23a8f53..094a6dc 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary_groupby_tag.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_groupby_boundary_groupby_tag.yaml @@ -45,7 +45,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:18 GMT + - Wed, 29 Nov 2023 14:34:11 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_groupby_key.yaml b/ohsome/test/cassettes/test_response/test_elements_count_groupby_key.yaml index b62f712..a2e7889 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_groupby_key.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_groupby_key.yaml @@ -50,7 +50,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:16 GMT + - Wed, 29 Nov 2023 14:34:08 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_groupby_tag.yaml b/ohsome/test/cassettes/test_response/test_elements_count_groupby_tag.yaml index 0b5ca59..307c88a 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_groupby_tag.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_groupby_tag.yaml @@ -128,7 +128,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:17 GMT + - Wed, 29 Nov 2023 14:34:09 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_groupby_type.yaml b/ohsome/test/cassettes/test_response/test_elements_count_groupby_type.yaml index fa5e773..5412c05 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_groupby_type.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_groupby_type.yaml @@ -50,7 +50,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:18 GMT + - Wed, 29 Nov 2023 14:34:11 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_ratio.yaml b/ohsome/test/cassettes/test_response/test_elements_count_ratio.yaml index bd90996..af8154b 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_ratio.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_ratio.yaml @@ -43,7 +43,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:20 GMT + - Wed, 29 Nov 2023 14:34:12 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_count_ratio_groupby_boundary.yaml b/ohsome/test/cassettes/test_response/test_elements_count_ratio_groupby_boundary.yaml index 49cc9da..8b210bf 100644 --- a/ohsome/test/cassettes/test_response/test_elements_count_ratio_groupby_boundary.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_count_ratio_groupby_boundary.yaml @@ -50,7 +50,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:20 GMT + - Wed, 29 Nov 2023 14:34:12 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_density.yaml b/ohsome/test/cassettes/test_response/test_elements_density.yaml index f3246f2..6f1bad6 100644 --- a/ohsome/test/cassettes/test_response/test_elements_density.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_density.yaml @@ -42,7 +42,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:16 GMT + - Wed, 29 Nov 2023 14:34:08 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_elements_geometry.yaml b/ohsome/test/cassettes/test_response/test_elements_geometry.yaml index 57c0c44..d8a2938 100644 --- a/ohsome/test/cassettes/test_response/test_elements_geometry.yaml +++ b/ohsome/test/cassettes/test_response/test_elements_geometry.yaml @@ -79,7 +79,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:55:20 GMT + - Wed, 29 Nov 2023 14:34:12 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_empty_geodataframe.yaml b/ohsome/test/cassettes/test_response/test_empty_geodataframe.yaml index 6677a51..285e424 100644 --- a/ohsome/test/cassettes/test_response/test_empty_geodataframe.yaml +++ b/ohsome/test/cassettes/test_response/test_empty_geodataframe.yaml @@ -41,7 +41,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Wed, 29 Nov 2023 13:55:23 GMT + - Wed, 29 Nov 2023 14:34:16 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_extra_tags_argument.yaml b/ohsome/test/cassettes/test_response/test_extra_tags_argument.yaml index 58f3ab3..f5d2ab7 100644 --- a/ohsome/test/cassettes/test_response/test_extra_tags_argument.yaml +++ b/ohsome/test/cassettes/test_response/test_extra_tags_argument.yaml @@ -81,7 +81,7 @@ interactions: Content-disposition: - attachment;filename=ohsome.geojson Date: - - Fri, 17 Nov 2023 14:22:26 GMT + - Wed, 29 Nov 2023 14:34:13 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_multi_index_false.yaml b/ohsome/test/cassettes/test_response/test_multi_index_false.yaml index 0b5ca59..307c88a 100644 --- a/ohsome/test/cassettes/test_response/test_multi_index_false.yaml +++ b/ohsome/test/cassettes/test_response/test_multi_index_false.yaml @@ -128,7 +128,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:17 GMT + - Wed, 29 Nov 2023 14:34:09 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_not_implemented_query.yaml b/ohsome/test/cassettes/test_response/test_not_implemented_query.yaml index b62f712..98fa3f9 100644 --- a/ohsome/test/cassettes/test_response/test_not_implemented_query.yaml +++ b/ohsome/test/cassettes/test_response/test_not_implemented_query.yaml @@ -50,7 +50,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:16 GMT + - Wed, 29 Nov 2023 14:34:09 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/cassettes/test_response/test_users_timestamp.yaml b/ohsome/test/cassettes/test_response/test_users_timestamp.yaml index 8a2ce30..b472b68 100644 --- a/ohsome/test/cassettes/test_response/test_users_timestamp.yaml +++ b/ohsome/test/cassettes/test_response/test_users_timestamp.yaml @@ -43,7 +43,7 @@ interactions: Content-Type: - application/json Date: - - Wed, 29 Nov 2023 13:55:21 GMT + - Wed, 29 Nov 2023 14:34:15 GMT Keep-Alive: - timeout=5, max=100 Server: diff --git a/ohsome/test/test_response.py b/ohsome/test/test_response.py index cb0a15a..34e33b0 100644 --- a/ohsome/test/test_response.py +++ b/ohsome/test/test_response.py @@ -346,6 +346,26 @@ def test_contributions_centroid(base_client): assert len(result) == 1 +@pytest.mark.vcr +def test_contributions_count_density_groupbyboundary(base_client): + """ + Tests whether the result of contributions.count.density.groupbyboundary.post is converted to a pandas.DataFrame + :return: + """ + bboxes = "8.7137,49.4096,8.717,49.4119" + time = "2015-01-01,2016-01-01" + filter = "name=Krautturm and type:way" + + client = base_client + response = client.contributions.count.density.groupByBoundary.post( + bboxes=bboxes, time=time, filter=filter + ) + result = response.as_dataframe() + + assert isinstance(result, pd.DataFrame) + assert len(result) == 1 + + @pytest.mark.vcr def test_contributions_latest(base_client): """