Last active
December 19, 2015 06:19
-
-
Save hrwgc/5910232 to your computer and use it in GitHub Desktop.
postgis select across polygon layers based on nearest adjacent polygon from other layer.
This file contains hidden or 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
create table | |
closest_point as | |
select distinct on (a.featureid) a.featureid as image_id, | |
(select b.eventid from fl_events as b order by st_distance(a.wkb_geometry,b.wkb_geometry) limit 1) as event_id, | |
a.wkb_geometry from images as a, | |
fl_events as b; | |
update images set eventid = closest_point.event_id from closest_point where images.featureid = closest_point.image_id; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment