1.带参数的sql语句
select gid as objectid,name,height,houseid,ST_AsGeoJson(geom) as geometry from changqing_polygon_house t where ST_Intersects(t.geom,ST_GeomFromGeoJSON($1))
2.变量赋值如下:
var _querygeo = {"type":"Polygon", "coordinates":[[ [114.23855855512208,30.64923619559406], [114.23991437809549,30.648874539105623], [114.23962204548032,30.64782926594492], [114.23822281860078,30.648105194339692], [114.23822820493294,30.648110441141277], [114.23855855512208,30.64923619559406] ]]};
需要转换为字符串后,再传值到sql变量数组中!记得坐标系和postgresql空间表保持一致