GeoServer杂记
创建SQL视图
%param%表示输入参数,可以接收前端
Guess parameters from SQL… 可以设定默认值,正则表达式验证
通过url访问:localhost:{port}/geoserver/ows?service=WFS&version=2.0.0&request=GetFeature&typeName=county:address_autocomplete&outputFormat=application/json&srsName=EPSG:3857&viewparams=query:100+old+high
SELECT
initcap(a.siteaddres || ', ' || city) AS address,
a.gid AS gid,
a.geom AS geom,
ts_rank_cd(a.ts, query) AS rank
FROM siteaddresses AS a,
to_tsquery_partial('%query%') AS query
WHERE ts @@ query
ORDER BY rank DESC
LIMIT 10
转载自:https://blog.csdn.net/dream15320/article/details/78369174