您好我使用以下postgres代码加入2个表
select m.object_id,
c.state_name as state,
upper(c.county) as county,
LTRIM(substring(m.reference,17,2),'0') ||'-'|| LTRIM(
substring(m.reference,6,3),'0')|| substring(m.reference,10,1)|| '-'||
LTRIM(substring(m.reference,11,3),'0')||substring(m.reference,15,1),
(st_area(st_transform(m.geom,2163))*0.000247105)::decimal(10,1),
st_transform(m.geom,4267),
LTRIM(substring(m.reference,17,2),'0') ||'-'|| LTRIM(
substring(m.reference,6,3),'0')|| substring(m.reference,10,1)|| '-'||
LTRIM(substring(m.reference,11,3),'0')||substring(m.reference,15,1),
st_transform(st_centroid(m.geom),4267),
null,
json_build_object('reference',m.reference),
m.source
from grid.merged_input m
left join grid.counties c on
st_intersects(c.geom, st_transform(m.geom,4267))
即使counties表具有非null值,c.state_name和c.county的值也都为空。有人可以帮我解决上面的postgres代码有什么问题。我在这里使用一些GIS功能。但我认为问题在于postgres代码本身。
谢谢!