Compare commits
No commits in common. "ddd2daf8cf2732a91350cda74ade6485c1adc81c" and "d7117665718638f1aed8aa4f3cf05c8c5a17f44a" have entirely different histories.
ddd2daf8cf
...
d711766571
78
init.sql
78
init.sql
@ -69,81 +69,3 @@ select
|
|||||||
join training t on (t.id = td_start.training_id)
|
join training t on (t.id = td_start.training_id)
|
||||||
order by td_start.t asc
|
order by td_start.t asc
|
||||||
);
|
);
|
||||||
|
|
||||||
---------------------------------------------
|
|
||||||
-- trovare allenamenti usando georeference --
|
|
||||||
---------------------------------------------
|
|
||||||
-- COSTANTI
|
|
||||||
-- via mirabello (dentro al parco): st_point(45.607115, 9.283687)
|
|
||||||
-- rotatoria Tamoil (per la via del nord): st_point(45.622779, 9.276274)
|
|
||||||
|
|
||||||
-- giro del parco di monza
|
|
||||||
create or replace view parco_monza_classico as
|
|
||||||
(
|
|
||||||
select duration,
|
|
||||||
distance,
|
|
||||||
pace_kmh,
|
|
||||||
start_time,
|
|
||||||
end_time,
|
|
||||||
start_location,
|
|
||||||
end_location,
|
|
||||||
training_id
|
|
||||||
from training_info ti
|
|
||||||
where ti.training_id in (
|
|
||||||
-- trovo id allenamenti che passano sicuramente per il parco di monza
|
|
||||||
select distinct t.id
|
|
||||||
from training t
|
|
||||||
join training_data td on (t.id = td.training_id)
|
|
||||||
join training_data td2 using (training_id)
|
|
||||||
where
|
|
||||||
distance < 31 and
|
|
||||||
st_dwithin(td.geog, st_point(45.607115, 9.283687), 20) -- se passo a 20 metri da via mirabello dentro al parco
|
|
||||||
and not st_dwithin(td2.geog, st_point(45.622779, 9.276274), 20) -- e se non passo dal tamoil
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
-- giro di arcore
|
|
||||||
create or replace view arcore as
|
|
||||||
(
|
|
||||||
select duration,
|
|
||||||
distance,
|
|
||||||
pace_kmh,
|
|
||||||
start_time,
|
|
||||||
end_time,
|
|
||||||
start_location,
|
|
||||||
end_location,
|
|
||||||
training_id
|
|
||||||
from training_info ti
|
|
||||||
where ti.training_id in (
|
|
||||||
select td.training_id
|
|
||||||
from training_data td join training_data td2 using (training_id)
|
|
||||||
where
|
|
||||||
distance < 42 and
|
|
||||||
end_location = 'Bicocca' and
|
|
||||||
st_dwithin(td.geog, st_point(45.622779, 9.276274), 20) -- se passo a 20 metri dal Tamoil
|
|
||||||
and st_dwithin(td2.geog, st_point(45.631299, 9.308985), 30) -- e se passo a 30 metri dalla rotatoria per arcore
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
create or replace view monticello as
|
|
||||||
(
|
|
||||||
select duration,
|
|
||||||
distance,
|
|
||||||
pace_kmh,
|
|
||||||
start_time,
|
|
||||||
end_time,
|
|
||||||
start_location,
|
|
||||||
end_location,
|
|
||||||
training_id
|
|
||||||
from training_info ti
|
|
||||||
where ti.training_id in (
|
|
||||||
select td.training_id
|
|
||||||
from training_data td join training_data td2 on (td.training_id = td2.training_id) join training_data td3 on (td.training_id = td3.training_id)
|
|
||||||
where
|
|
||||||
distance < 61 and
|
|
||||||
end_location = 'Bicocca' and
|
|
||||||
st_dwithin(td.geog, st_point(45.622779, 9.276274), 20) -- se passo per il Tamoil
|
|
||||||
and st_dwithin(td2.geog, st_point(45.631299, 9.308985), 30) -- e se passo a 30 metri dalla rotatoria per arcore
|
|
||||||
and st_dwithin(td3.geog, st_point(45.705275, 9.305889), 20) -- e se passo a 20 metri dalla fontanella di Monticello
|
|
||||||
)
|
|
||||||
);
|
|
Loading…
x
Reference in New Issue
Block a user