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
-- function that calculates the CBS Vierkantstatistieken grid cell for point coordinates in RD new. | |
create or replace function get_cbsvierkantid(fn_geom geometry, i_dist int) returns text as $$ | |
select | |
'E' || | |
((st_x(fn_geom)::numeric - (st_x(fn_geom)::numeric % i_dist)) / 100)::int || | |
'N' || | |
((st_y(fn_geom)::numeric - (st_y(fn_geom)::numeric % i_dist)) / 100)::int | |
as cbs_vierkant_id | |
; |
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
-- blades part adapted from "https://gis.stackexchange.com/questions/104439/how-to-extend-a-straight-line-in-postgis" | |
with medialaxis_multi as( | |
select | |
polygons.id, | |
st_union(ST_ApproximateMedialAxis(geom)) as geom | |
from | |
polygons | |
group by | |
polygons.id | |
), |