SQL如下:
update mapping_nj_roads
set municipality=‘227‘
from mapping_geodata_boundary a
where a.supportfile_code=‘227‘ and
(a.boundary.STContains(mapping_nj_roads.geom)=1 or a.boundary.STIntersects(mapping_nj_roads.geom)=1)
#1 mapping_nj_roads 是新泽西的所有的道路的表,geom是路的geometry字段
#2 mapping_geodata_boundary是新泽西所有的boundary的表,boundary是geometry字段
#3 227是bergen county的一个township
#4 用到的方法:STContains【包含】、STIntersects【相交】