在PG数据里创建一张表
CREATE TABLE public.month
(code character(50),
month date,
value double precision
)
插入数据这样,
INSERT INTO public.month(
code, month, value)
VALUES ('code1', '2013-07-02', 3); //code1对应点编号
geoserver里发布SQL View
然后发布图层。。。
调用刚才发布的数据
http://localhost:8093/geoserver/wfs?service=WFS&version=1.1.0&request=GetFeature&typename=zaozhuangshi:pgView&viewparams=code:code1&outputFormat=json
ajax获取解析来的数据。。。。。
$.ajax({
url : urlText,
data : 'post',
async : false,
success : function(response) {
var parser = new ol.format.GeoJSON();
var result = parser.readFeatures(response);
}, //end of success
error : function(xhr, ajaxOptions, thrownError) {
alert(xhr.status);
alert(thrownError);
}
});