I think I've earned my geonerd points today.
— ⚛⚛⚛Iván Sánchez⚛⚛⚛ (@RealIvanSanchez) April 29, 2022
(re: https://t.co/84PGLpHLDZ ) pic.twitter.com/MZGwI76zSG
select
*
from (
select
gid, (st_dumppoints(geom)).*
from
ne_10m_admin_0_countries ) f
;
select
st_project(
st_setsrid(st_point(-30,0), 4326)::geography,
st_distance(st_setsrid(st_point(0,90),4326)::geography, geom::geography),
st_azimuth(st_setsrid(st_point(0,90),4326)::geography, geom::geography) - radians(125)
)::geometry(point, 4326) as geom,
row_number() over()::int as oid, gid, path
from (
select
gid, (st_dumppoints(geom)).*
from
ne_10m_admin_0_countries ) f
where
st_y(geom) >-88
;
select
*
from (
select gid, (st_dumppoints(geom)).*
from ne_10m_admin_0_countries
) f
;
select
st_buffer(
st_setsrid(st_point(0,0),4326)::geography,
st_distance(st_setsrid(st_point(0,90),4326)::geography, geom::geography) / pi()
)::geometry(polygon, 4326)
from (
select gid, (st_dumppoints(geom)).*
from ne_10m_admin_0_countries
) f
;
select
st_rotate(
st_exteriorring(
st_buffer(
st_setsrid(st_point(0,0),4326)::geography,
st_distance(st_setsrid(st_point(0,90),4326)::geography, geom::geography) / pi()
)::geometry(polygon, 4326)
),
radians(90)
)
from (
select gid, (st_dumppoints(geom)).*
from ne_10m_admin_0_countries
) f
;
select
st_scale(
st_rotate(
st_exteriorring(
st_buffer(
st_setsrid(st_point(0,0),4326)::geography,
st_distance(st_setsrid(st_point(0,90),4326)::geography, geom::geography) / pi()
)::geometry(polygon, 4326)
),
radians(90)
), 1.70, 1.70
)
from (
select gid, (st_dumppoints(geom)).*
from ne_10m_admin_0_countries
) f
where st_y(geom) >-85 and st_y(geom) < 85
;
select
st_lineinterpolatepoint(
st_scale(
st_rotate(
st_exteriorring(
st_buffer(
st_setsrid(st_point(0,0),4326)::geography,
st_distance(st_setsrid(st_point(0,90),4326)::geography, geom::geography) / pi()
)::geometry(polygon, 4326)
),
radians(90)
), 1.70, 1.70
),
st_azimuth(st_setsrid(st_point(0, 90),4326)::geography, geom::geography) / (2*pi())
) as geom, gid, path
from (
select gid, (st_dumppoints(geom)).*
from ne_10m_admin_0_countries
) f
where st_y(geom) >-85 and st_y(geom) < 85
;
select
st_force3d(
st_point(
x,
y + temperature * 1000
)
)
from (
select temperature, valid_from, valid_to, x, y from phenomen
) f
;
select
st_setsrid(
st_translate(
st_force3d(
st_point(
x,
y + temperature * 1000
)
), 0, 0, temperature
), 3301
)
from (
select temperature, valid_from, valid_to, x, y from phenomen
) f
;
select
st_makeline(
array_agg(
st_setsrid(
st_translate(
st_force3d(
st_point(
x,
y + temperature * 1000
)
), 0, 0, temperature
), 3301
) order by x
)
)
from (
select temperature, valid_from, valid_to, x, y from phenomen
) f
group by y, valid_from, valid_to;
select
st_chaikinsmoothing(
st_makeline(
array_agg(
st_setsrid(
st_translate(
st_force3d(
st_point(
x,
y + temperature * 1000
)
), 0, 0, temperature
), 3301
) order by x
)
), 5
) as geom, y, valid_from, valid_to
from (
select temperature, valid_from, valid_to, x, y from phenomen
) f
group by y, valid_from, valid_to;
with segments as (
select
oid, st_dumppoints(geom) as pt
from
chaikinlines_temperature
)
select
*
from
segments
;
with segments as (
select
st_makeline(
lag((pt).geom, 1, null) over(
partition by y, valid_from order by valid_from, y, (pt).path
),
(pt).geom
) as geom, valid_from, valid_to
from (
select
oid, st_dumppoints(geom) as pt
from
chaikinlines_temperature
) as dumps
)
select
*
from
segments
where
geom is not null;
with segments as (
select
st_makeline(
lag((pt).geom, 1, null) over(
partition by y, valid_from order by valid_from, y, (pt).path
),
(pt).geom
) as geom, valid_from, valid_to
from (
select
oid, st_dumppoints(geom) as pt
from
chaikinlines_temperature
) as dumps
)
select
geom, st_z(st_lineinterpolatepoint(geom, 0.5)) as temperature, valid_from, valid_to
from
segments
where
geom is not null;
select
*
from (
select
st_transform(
st_project(
grid::geography, coalesce(wind_speed_mps,0)*500, radians(coalesce(wind_direction_deg, 0))-pi()
)::geometry(point, 4326),
3301) as geom, wind_speed_mps, wind_direction_deg, valid_from, valid_to
from
phenomen
) f;
select
st_ellipse(
st_x(geom), st_y(geom),
2500, 2500 + (coalesce(wind_speed_mps,0)*1000), 0, 16
)
from (
select
st_transform(
st_project(
grid::geography, coalesce(wind_speed_mps,0)*500, radians(coalesce(wind_direction_deg, 0))-pi()
)::geometry(point, 4326),
3301) as geom, wind_speed_mps, wind_direction_deg, valid_from, valid_to
from
phenomen
) f;
select
st_rotate(
st_setsrid(
st_ellipse(
st_x(geom), st_y(geom),
2500, 2500 + (coalesce(wind_speed_mps,0)*1000), 0, 16
),
3301
),
-1*(radians(wind_direction_deg) + pi()),
geom
) as geom, wind_speed_mps, wind_direction_deg, valid_from, valid_to
from (
select
st_transform(
st_project(
grid::geography, coalesce(wind_speed_mps,0)*500, radians(coalesce(wind_direction_deg, 0))-pi()
)::geometry(point, 4326),
3301) as geom, wind_speed_mps, wind_direction_deg, valid_from, valid_to
from
phenomen
) f;