多边形中的点,多个多边形 [英] Points in Polygon, multiple polygons
问题描述
我有这个查询,在我的dst db中,通过将点与src中的多边形匹配来填充prem_council列.但是,我只能通过手动执行每个分区1-15来手动完成操作.
I have this query working where I populated the prem_council column in my dst db by matching points with polygons in the src. But, I could only do it manually by stepping through each district 1-15 manually.
UPDATE poursafe.ca_licenses dst
SET prem_council = '1'
FROM ca_la_la_areas_council_dist_2012 src
WHERE EXISTS (
SELECT *
FROM public.ca_la_la_areas_council_dist_2012 src
WHERE ST_Within(dst.geom, src.geom )
AND district = '1'
);
我不知道该怎么做,不知道您是否可以告诉我如何使流程自动化,这样我就不必手动进行每个分区了?我问的原因是我还有其他几个地理表格,需要执行类似的过程.谢谢!
I can't figure out how and wonder if you can tell me how I could automate the process so I don't have to do each district manually? The reason I ask is I have several other geographic tables and need to do a similar process. Thanks!
推荐答案
对我来说这是黑盒,没有表定义和表的几何类型 但是,如果您尝试在两个表(ca_licenses和ca_la_la_areas_council_dist_2012)之间建立关系,则只需将区的值设置为prem_council即可.
it is blackbox for me without table defination and geometry type of table but if you try to make relation between two tables(ca_licenses and ca_la_la_areas_council_dist_2012), you can simply set district's values to prem_council ;
update poursafe.ca_licenses dst
set prem_council = district
from ca_la_la_areas_council_dist_2012 src
where st_within(dst.geom,src.geom) and dst.geom&&src.geom --to accelerate query
查询不能解决您的问题,请为您的问题添加表的定义和更新条件.
Query doesn't solve your problem , pls add table's defination and update conditions to your question.
这篇关于多边形中的点,多个多边形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!