Skip to content

Commit

Permalink
V2
Browse files Browse the repository at this point in the history
new filter for direct WMTS layers loading
major refactoring
  • Loading branch information
3nids authored Aug 15, 2022
2 parents 690ffc4 + 1ded651 commit a0d74e6
Show file tree
Hide file tree
Showing 36 changed files with 8,895 additions and 8,457 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push-translations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: checkout submodules
run: |
sed -i 's#git@github.com:#https://github.com/#' .gitmodules
git submodule update --init --recursive
sed -i 's#https://github.com/#git@github.com:#' .gitmodules
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python 3.8
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Run Tests
on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

env:
QGIS_TEST_VERSION: latest


jobs:
qgis_deps_build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: docker test
run: |
docker run -v $(pwd):/usr/src -w /usr/src opengisch/qgis:${QGIS_TEST_VERSION} sh -c 'xvfb-run pytest-3 --ignore-glob=**/qgissettingmanager/*'
4 changes: 2 additions & 2 deletions .github/workflows/update-layers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:

steps:
- name: Get source code
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ __pycache__
i18n
.DS_Store
github_deploy_key.out
swiss_locator/resources_rcs.py
swiss_locator/resources_rc.py
12 changes: 12 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
repos:
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3

- repo: https://gitlab.com/pycqa/flake8
rev: 3.9.2
hooks:
- id: flake8
args: ['--ignore=E203,E402,E501,W503']
3 changes: 3 additions & 0 deletions swiss_locator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
***************************************************************************/
"""

DEBUG = False


def classFactory(iface):
"""Load plugin.
Expand All @@ -30,4 +32,5 @@ def classFactory(iface):
"""
#
from .swiss_locator_plugin import SwissLocatorPlugin

return SwissLocatorPlugin(iface)
Empty file.
8 changes: 8 additions & 0 deletions swiss_locator/core/filters/filter_type.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from enum import Enum


class FilterType(Enum):
Location = "locations"
Layers = "layers" # this is used in map.geo.admin as the search type
Feature = "featuresearch" # this is used in map.geo.admin as the search type
WMTS = "wmts"
14 changes: 14 additions & 0 deletions swiss_locator/core/filters/map_geo_admin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def map_geo_admin_url(search: str, _type: str, crs: str, lang: str, limit: int):
base_url = "https://api3.geo.admin.ch/rest/services/api/SearchServer"
base_params = {
"type": _type,
"searchText": str(search),
"returnGeometry": "true",
"lang": lang,
"sr": crs,
"limit": str(limit)
# bbox Must be provided if the searchText is not.
# A comma separated list of 4 coordinates representing
# the bounding box on which features should be filtered (SRID: 21781).
}
return base_url, base_params
4 changes: 4 additions & 0 deletions swiss_locator/core/filters/opendata_swiss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def opendata_swiss_url(search: str):
url = "https://opendata.swiss/api/3/action/package_search?"
params = {"q": "q=Layers+%C3" + str(search)}
return url, params
Loading

0 comments on commit a0d74e6

Please sign in to comment.