From 9312e1b3513100c229fc67308bddf9132b284c9e Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 27 Sep 2023 19:18:19 +0200 Subject: Search filter: search only for mushrooms and plants of interest naturewise. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hence remove invasive species and “other” categories from the style file. --- gis-observation-map | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'gis-observation-map') diff --git a/gis-observation-map b/gis-observation-map index 23ca88e..afc4071 100755 --- a/gis-observation-map +++ b/gis-observation-map @@ -391,12 +391,15 @@ def getObservations(taxonLists, taxonRedlistCategories, data): properties[k] = v # TODO generate GPKG instead and reproject to EPSG:3006 - path = projectHome.joinpath('fynd.geojson') + path = projectHome.joinpath('observations.geojson') with path.open(mode='w') as fp: json.dump(obs, fp, indent=2, ensure_ascii=False) if projectInstance is not None: - layer = QgsVectorLayer(path.as_posix() + '''|subset="Kingdom" IN ('Fungi', 'Plantae') AND "IsPositiveObservation" AND "IsNaturalOccurrence" AND NOT "IsNotRediscoveredObservation" AND "CoordinateUncertaintyInMeters" <= 250''', path.stem, 'ogr') + layer = QgsVectorLayer( + path.as_posix() + '''|subset="IsPositiveObservation" AND "IsNaturalOccurrence" AND "CoordinateUncertaintyInMeters" <= 250''', + 'Fynd', 'ogr' + ) if not layer.isValid(): raise Exception(f'ERROR: {path}: failed to load in QGIS') if 'QGIS' in config.keys() and 'style' in config['QGIS']: @@ -621,6 +624,27 @@ searchFilter = { } } +# https://artfakta.se/artinformation/taxa/biota-0/detaljer +kingdomIds = { + 'Animalia': 5000001, + 'Archaea': 5000082, + 'Bacteria': 5000052, + 'Chromista': 5000055, + 'Fungi': 5000039, + 'Plantae': 5000045, + 'Protozoa': 5000060, + 'Viruses': 5000083, + 'Algae': 6001047, +} + +searchFilter['taxon'] = { + 'ids': list(map(lambda k: kingdomIds[k], ['Fungi', 'Plantae'])), + 'includeUnderlyingTaxa': True, + # https://github.com/biodiversitydata-se/SOS/blob/master/Docs/SearchFilter.md#taxon-lists + 'taxonListIds': [1, 2, 7, 8, 13, 18], + 'taxonListOperator': 'Filter' +} + getObservations(taxonLists, taxonRedlistCategories, searchFilter) topo_maps = ['Topografi 10', 'Topografi 50', 'Topografi 100'] -- cgit v1.2.3