-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bca1cec
commit 1499e27
Showing
6 changed files
with
59 additions
and
248 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
DROP TABLE IF EXISTS species_202001.attributes_sp;CREATE TABLE species_202001.attributes_sp AS | ||
SELECT * FROM species_202001.attributes_sp_birdlife | ||
UNION | ||
SELECT * FROM species_202001.attributes_sp_iucn | ||
ORDER BY class,order_,family,genus,id_no; |
24 changes: 24 additions & 0 deletions
24
processing/species/species_2020/creates_attributes_sp_birdlife.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
-- creates table BIRDLIFE_SPATIAL_ATTRIBUTES as selection of attributes from spatial data | ||
DROP TABLE IF EXISTS species_202001.attributes_sp_birdlife; | ||
CREATE TABLE species_202001.attributes_sp_birdlife AS | ||
WITH | ||
a AS ( | ||
SELECT DISTINCT | ||
id_no::bigint, | ||
binomial::text, | ||
kingdom::text, | ||
phylum::text, | ||
class::text, | ||
order_::text, | ||
family::text, | ||
genus::text, | ||
category::text, | ||
-- aggregates biome_marine,biome_terrestrial and biome_freshwater ecosystems in ecosystem_mtf (marine,terrestrial,freshwater). | ||
CONCAT( | ||
(CASE WHEN biome_marine = 'true' THEN 1 ELSE 0 END), | ||
(CASE WHEN biome_terrestrial = 'true' THEN 1 ELSE 0 END), | ||
(CASE WHEN biome_freshwater = 'true' THEN 1 ELSE 0 END)) ecosystem_mtf | ||
FROM species_202001.birds_additional_atts | ||
ORDER BY id_no) | ||
-- select only attributes matching geometric objects | ||
SELECT DISTINCT * FROM a WHERE id_no IN (SELECT DISTINCT sisid FROM species_202001.birds_all_species) ORDER BY id_no; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters