-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
6 changed files
with
97 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
"pipenv", | ||
"pipfile", | ||
"POSTGIS", | ||
"psycog", | ||
"psycopg", | ||
"pyenv", | ||
"pypi", | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,34 @@ | ||
drop view if exists metadata; | ||
|
||
create view metadata as | ||
select | ||
modelId, | ||
min_x, | ||
max_x, | ||
min_y, | ||
max_y, | ||
st_makeenvelope (min_x, min_y, max_x, max_y, 4326) extent | ||
from ( | ||
do $$ | ||
begin | ||
if exists ( | ||
select | ||
1 | ||
from | ||
pg_matviews | ||
where | ||
matviewname = 'metadata') then | ||
refresh materialized view metadata; | ||
else | ||
create materialized view metadata as | ||
select | ||
c.modelId, | ||
min(c.longitude) min_x, | ||
max(c.longitude) max_x, | ||
max(c.latitude) max_y, | ||
min(c.latitude) min_y | ||
from | ||
coordinates c | ||
group by | ||
modelId) t | ||
modelId, | ||
min_x, | ||
max_x, | ||
min_y, | ||
max_y, | ||
st_makeenvelope (min_x, min_y, max_x, max_y, 4326) extent | ||
from ( | ||
select | ||
c.modelId, | ||
min(c.longitude) min_x, | ||
max(c.longitude) max_x, | ||
max(c.latitude) max_y, | ||
min(c.latitude) min_y | ||
from | ||
coordinates c | ||
group by | ||
modelId) t; | ||
end if; | ||
end | ||
$$; | ||
|
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 |
---|---|---|
@@ -1,7 +1,12 @@ | ||
-- MATERIALIZED VIEWS | ||
drop materialized view if exists public.coordinates cascade; | ||
drop materialized view if exists public.metadata cascade; | ||
|
||
-- TABLES | ||
drop table if exists public.coordinates cascade; | ||
|
||
drop table if exists public.raster_xref_model cascade; | ||
|
||
drop table if exists public.models cascade; | ||
drop table if exists public.rasters cascade; | ||
|
||
drop table if exists public.rasters cascade; | ||
|
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