22 十月 17:18:10 WARN [xsd.impl] - Error parsing: http://schemas.opengis.net/wfs/1.1.0/wfs.xsd
22 十月 17:18:10 WARN [xsd.impl] - Could not find a schema
22 十月 17:18:10 WARN [geoserver.ows] - Unable to parse filter: <GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="text/javascript" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"><Query typeName="map:两区地块" srsName="EPSG:3857" xmlns:map="http://localhost:8080/"><Filter xmlns="http://www.opengis.net/ogc"><PropertyIsLike wildCard="*" singleChar="." escapeChar="!"><PropertyName>CJQYMC</PropertyName><Literal>*双庙村*</Literal></PropertyIsLike></Filter></Query></GetFeature>
多??的一个错误,感谢cn一个wall让各行各业国际标准策略网站都访问不了,这个警告的最致命的就是,你wfs服务搜索?慢的像是搜索了几百t的数据,开始我以为是数据太大所有搜索速度太慢,但是我想了一下不可能,geoserver不可能性能差到要25s才整搜索出来。
我的解决思路:
1、vpn一下到全局
让geoserver可以访问这个schema ,显然我这个穷屌没有vpn。
2、下载schema,自己写一个服务器给geoserver,修改地址。
显然我也不会,一个策略连着一个策略,估计要几十个策略。
3、思考?。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。。
一直盯着屏幕,忍着糟糕到极致的情绪,忍着熬夜到五点闭眼30秒就能睡着的难受。
灵光一现,
既然这个策略读不出来都可以访问数据,那我为什么不给他搞掉,直接替换成“ ”
灵光一现,终于搞完了。
var featureRequest = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:3857',
featureNS: 'http://localhost:8080/', //命名空间
featurePrefix: 'map', //工作区域
featureTypes: ['两区地块'], //图层名
outputFormat: 'text/javascript',
filter:
// fcodeFilter
// areaFilter
//组合两种过滤器
new ol.format.filter.like('CJQYMC', '*双庙村*') //todo 条件查询过滤
});
/* var featureRequest = new ol.format.WFS().writeGetFeature({
srsName: 'EPSG:4326',
/!* featureNS: 'http://localhost:8080/geoserver',
featurePrefix: 'quzhou',
featureTypes: ['20CC96E96AF7BE2780287906F67F5369'],
outputFormat: 'text/javascript',*!/
//filter: ol.format.ogc.filter.like('NAME', '姜家山乡沃华农庄(2A)')
filter: ol.format.filter.like('CJQYMC', '水产研究所')
});*/
/*<GetFeature xmlns="http://www.opengis.net/wfs" service="WFS" version="1.1.0" outputFormat="application/json" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd">
<Query typeName="map:两区地块" srsName="EPSG:4326" xmlns:map="http://localhost:8080/map">
<Filter xmlns="http://www.opengis.net/ogc">
<PropertyIsLike wildCard="*" singleChar="." escapeChar="!">
<PropertyName>CJQYMC</PropertyName>
<Literal>水产研究所</Literal>
</PropertyIsLike>
</Filter>
</Query>
</GetFeature>*/
var body = new XMLSerializer().serializeToString(featureRequest);
console.log(body);//http://localhost:8080/geoserver/ows?service=wfs&version=1.1.0&request=GetCapabilities
//localhost:8080/geoserver/map/ows?service=WFS&version=1.0.0&
// request=GetFeature&typeName=map%3A%E4%B8%A4%E5%8C%BA%E5%9C%B0%E5%9D%97&maxFeatures=50&outputFormat=text%2Fjavascript
var wfsParams = {
srs:'EPSG:3857',
service : 'WFS',
version : '1.0.0',
request : 'GetFeature',
typeName : name,//图层名称
/* filter: ol.format.filter.equalTo('CJQYMC', '夏岗村'),*/
outputFormat : 'text/javascript', //重点,不要改变
MAXFEATURES: 50,
format_options : 'callback:loadFeatures' //回调函数声明
};
var url = 'http://localhost:8080/geoserver/map/ows';
console.log('http://localhost:8080/geoserver/map/wfs?'+$.param(wfsParams)+'&FILTER='+body);
var ss = body.replace("xsi:schemaLocation=\"http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd\"","");
var data1='';
$.ajax({
url: url,
async:false,
type : 'GET',
data : $.param(wfsParams)+'&FILTER='+ss,
//data : body,
// data : $.param(wfsParams)+'&FILTER='+"[ CJQYMC is like 水产研究所 ]",
dataType: 'jsonp', //解决跨域的关键
jsonpCallback:'loadFeatures' , //回调
success: function (data) {
console.log(data.features);
}
)
然后ctr+f9编译,再次查询发现只要3s,网上没有一个解决方案,但是我觉着一定有人遇到这种困难,转载的时候注明出处,帮到你了 ,请粉?,?帮你节约了一天的时间。