Skip to content

Commit ff34895

Browse files
authored
Merge pull request #52 from GIScience/development
Development
2 parents 4721de0 + c5ce93f commit ff34895

16 files changed

Lines changed: 819 additions & 697 deletions
Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
name: tests
1+
name: Continous Integration for development
22

33
on:
44
pull_request:
5-
branches: '**'
6-
push:
7-
branches:
8-
- master
5+
branches: [ "**" ]
96

107
jobs:
118
lint:
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Continous Integration
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
release:
9+
types:
10+
- created
11+
12+
jobs:
13+
linux-tests:
14+
strategy:
15+
fail-fast: true
16+
matrix:
17+
config:
18+
- python-version: 3.6
19+
tox: 36
20+
- python-version: 3.7
21+
tox: 37
22+
- python-version: 3.8
23+
tox: 38
24+
- python-version: 3.9
25+
tox: 39
26+
poetry-version: [ 1.1.4 ]
27+
os: [ ubuntu-18.04, ubuntu-20.04 ]
28+
runs-on: ${{ matrix.os }}
29+
services:
30+
ohsome-api:
31+
image: julianpsotta/ohsome-api:1.3.2
32+
ports:
33+
- 8080:8080
34+
steps:
35+
- uses: actions/checkout@v2
36+
- name: Set up testing Python ${{ matrix.config.python-version }}
37+
uses: actions/setup-python@v2
38+
with:
39+
python-version: ${{ matrix.config.python-version }}
40+
- name: Set up base Python 3.9
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: 3.9
44+
- name: Python Poetry Action
45+
uses: abatilo/actions-poetry@v2.1.0
46+
with:
47+
poetry-version: ${{ matrix.poetry-version }}
48+
- name: Install dependencies
49+
run: |
50+
sudo add-apt-repository -y ppa:ubuntugis/ppa && sudo apt-get update && sudo apt-get install -y build-essential gdal-bin libgdal-dev
51+
python -m pip install --upgrade pip tox
52+
- name: Run tox
53+
env:
54+
OHSOME_URL: ohsome-api
55+
OHSOME_PORT: 8080
56+
TOX_TESTENV_PASSENV: OHSOME_URL, OHSOME_PORT
57+
run: tox -e py${{ matrix.config.tox }}
58+
- name: Upload coverage to Codecov
59+
uses: codecov/codecov-action@v1
60+
with:
61+
token: ${{ secrets.CODECOV_TOKEN }}
62+
flags: unittests
63+
env_vars: OS,PYTHON
64+
name: codecov-umbrella
65+
fail_ci_if_error: true
66+
verbose: true
67+
build-and-publish:
68+
name: Build and publish Python distributions 📦 to PyPI and TestPyPI
69+
runs-on: ubuntu-20.04
70+
needs:
71+
- linux-tests
72+
steps:
73+
- uses: actions/checkout@v2
74+
- name: Set up base Python 3.9
75+
uses: actions/setup-python@v2
76+
with:
77+
python-version: 3.9
78+
- name: Python Poetry Action
79+
uses: abatilo/actions-poetry@v2.1.0
80+
with:
81+
poetry-version: 1.1.4
82+
- name: Publish distribution 📦 with test.pypi.org
83+
if: startsWith(github.ref, 'refs/tags')
84+
run: |
85+
poetry config repositories.testpypi https://test.pypi.org/legacy/
86+
poetry config pypi-token.testpypi ${{ secrets.TEST_PYPI_API_TOKEN }}
87+
poetry build
88+
poetry publish -r testpypi
89+
- name: Publish distribution 📦 to PyPI
90+
if: startsWith(github.ref, 'refs/tags')
91+
run: |
92+
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
93+
poetry build
94+
poetry publish

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,5 @@ repos:
4040
args: [ '--no-sort-keys' ]
4141
- id: no-commit-to-branch
4242
args: [ --branch, master ]
43+
- id: no-commit-to-branch
44+
args: [ --branch, main ]

README.md

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,17 @@
44

55
The *ohsome-py* package helps you extract and analyse OpenStreetMap history data using the [ohsome API](https://docs.ohsome.org/ohsome-api/v1/) and Python. It handles queries to the [ohsome API](https://docs.ohsome.org/ohsome-api/v1/) and converts its responses to [Pandas](https://pandas.pydata.org/) and [GeoPandas](https://geopandas.org/) data frames to facilitate easy data handling and analysis.
66

7-
The ohsome API provides various endpoints for [data aggregation](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=Data%20Aggregation), [data extraction](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=dataExtraction) and [contributions](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=Contributions). Take a look at the [documentation of the ohsome API](https://docs.ohsome.org/ohsome-api/stable) to learn more about the endpoints and query parameters or go through the [Tutorial](https://github.com/GIScience/ohsome-py/blob/master/notebooks/Tutorial.ipynb) to get started.
7+
The ohsome API provides various endpoints for [data aggregation](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=Data%20Aggregation), [data extraction](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=dataExtraction) and [contributions](https://api.ohsome.org/v1/swagger-ui.html?urls.primaryName=Contributions) to analyse the history of OSM data. Take a look at the [documentation of the ohsome API](https://docs.ohsome.org/ohsome-api/stable) or go through the [Tutorial](https://github.com/GIScience/ohsome-py/blob/master/notebooks/Tutorial.ipynb) to get started on how to use *ohsome-py*.
88

99

1010
## Installation
1111

12-
The easiest way to install *ohsome-py* is using pip:
12+
*ohsome-py* requires Python >= 3.6. The easiest way to install *ohsome-py* is using pip:
1313

1414
```
1515
$ pip install ohsome
1616
```
1717

18-
To install the latest *ohsome-py* version from GitHub:
19-
20-
```
21-
$ pip install git+https://github.com/giscience/ohsome-py
22-
```
23-
2418
If you want to run the Juypter Notebook [Tutorial](https://github.com/GIScience/ohsome-py/blob/master/notebooks/Tutorial.ipynb) you also need to install `jupyter` and `matplotlib`:
2519

2620
```
@@ -73,10 +67,10 @@ response = client.elements.geometry.post(bboxes=[8.625,49.3711,8.7334,49.4397],
7367
time="2020-01-01",
7468
filter="landuse=farmland and type:way",
7569
properties="tags")
76-
response_gdf = response.as_geodataframe()
70+
response_gdf = response.as_dataframe()
7771
```
7872

79-
Responses from the data extraction endpoint can be converted to a `geopandas.GeoDataFrame` using the `OhsomeResponse.as_geodataframe()` method, since the data contains geometries.
73+
Responses from the data extraction endpoint can be converted to a `geopandas.GeoDataFrame` using the `OhsomeResponse.as_dataframe()` method, since the data contains geometries.
8074

8175
### Query Parameters
8276

notebooks/Public_Green_Spaces_in_OSM.ipynb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"radius = 10000\n",
23+
"radius = 5000\n",
2424
"cities = {\"Tokyo\": [139.7594549, 35.6828387, radius], # lon, lat, radius\n",
2525
" #\"Berlin\": [13.3888599, 52.5170365, radius],\n",
2626
" \"London\": [-0.1276474, 51.5073219, radius],\n",
@@ -53,16 +53,6 @@
5353
"##### Import modules"
5454
]
5555
},
56-
{
57-
"cell_type": "code",
58-
"execution_count": 3,
59-
"metadata": {},
60-
"outputs": [],
61-
"source": [
62-
"import sys\n",
63-
"sys.path.append('..')"
64-
]
65-
},
6656
{
6757
"cell_type": "code",
6858
"execution_count": 4,
@@ -280,7 +270,7 @@
280270
"cell_type": "markdown",
281271
"metadata": {},
282272
"source": [
283-
"### 1.0 How many public green spaces have been mapped in each city?"
273+
"### How many public green spaces have been mapped in each city?"
284274
]
285275
},
286276
{
@@ -561,7 +551,7 @@
561551
" time=client.end_timestamp, \n",
562552
" properties=\"tags\",\n",
563553
" filter=\"({}) and type:way\".format(\" or \".join(tags)))\n",
564-
" greenspace_city = response_geometry.as_geodataframe().droplevel(1)#.loc[:,[\"leisure\", \"landuse\", \"geometry\"]]\n",
554+
" greenspace_city = response_geometry.as_dataframe().droplevel(1)#.loc[:,[\"leisure\", \"landuse\", \"geometry\"]]\n",
565555
" greenspace_city[\"area\"] = reproject_to_utm(greenspace_city).area\n",
566556
" # Create tag column\n",
567557
" tag_series = []\n",
@@ -762,7 +752,7 @@
762752
"name": "python",
763753
"nbconvert_exporter": "python",
764754
"pygments_lexer": "ipython3",
765-
"version": "3.8.6"
755+
"version": "3.9.2"
766756
}
767757
},
768758
"nbformat": 4,

0 commit comments

Comments
 (0)