You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use ST_Subdivide in query ? Looks like it can speed things up substantially... like 300%
library(microbenchmark)
library(sf)
qq1 <- paste0("WITH subdivided_my_wkt AS (SELECT ST_Subdivide(ST_GeomFromText('", new_ws2_wkt, "', 3005), 100) AS geom),
clipped_polys AS (
SELECT w.*,
ST_Intersection(w.geom, s.geom) AS clipped_geom
FROM fwa_wetlands w
CROSS JOIN subdivided_my_wkt s
WHERE ST_Intersects(w.geom, s.geom))
SELECT *,
ST_Area(clipped_geom) AS clipped_area_m2
FROM clipped_polys")
qq2 <- paste0("SELECT w.*, ST_Intersection(w.geom, ST_GeomFromText('", new_ws2_wkt, "', 3005)) AS clipped_geom
FROM fwa_wetlands w
WHERE ST_Intersects(w.geom, ST_GeomFromText('", new_ws2_wkt, "', 3005))")
microbenchmark(st_read(conn, query = qq1),st_read(conn, query = qq2), times = 1)
Simplify polygons?
Display as points?
The text was updated successfully, but these errors were encountered: