cartodb - how to detect polygons within other (many) polygons in postgis -
i have 2 datasets: 1. zipcodes , 2. neighborhoods (think of them counties).
i want join each neighborhood zipcodes cover it. neighborhoods within 1 zipcode, in cases neighborhoods straddle two. example:
neighborhood 1 inside 20001
neighborhood 2 inside 20002
neighborhood 3 inside 20001,20002
here have far:
select name, zipcode neighborhood_names nn, dc_zipcode_boundries dzb st_intersects(nn.the_geom, dzb.the_geom);
note: updated within based on comments, getting answer each neighborhood still not able array function respond expected.
i figured out. john. statement needed group (whcih error said, needed time digest before clicked).
the snippet below worked following
select name, array_to_string(array_agg(zipcode), ',') neighborhood_names nn, dc_zipcode_boundries dzb st_intersects(nn.the_geom, dzb.the_geom) group name
Comments
Post a Comment