0915-0921周
0917
- 组织树的简单递归算法实现
data.forEach(item=>{
recursiveTraverse(item);
});
const recursiveTraverse = function (node) {
if (!node || node['children'].length === 0) {
node['children'] = null;
return;
}
node['children'].forEach(function(item) {
recursiveTraverse(item);
});
};
0918
- geoserver中对于restful api使用时遇到401和403问题的解决办法:(1)遇到401时,需要在请求的headers中携带'Authorization': 'Basic YWRtaW46Z2Vvc2VydmVy'来进行解决;(2)遇到403时,说明在web.xml中,跨域信息没有完全打开,此时需要打开跨域请求,即:
<filter>
<filter-name>cross-origin</filter-name>
<filter-class>org.eclipse.jetty.servlets.CrossOriginFilter</filter-class>
<init-param>
<param-name>chainPreflight</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>allowedOrigins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>allowedMethods</param-name>
<param-value>GET,POST,PUT,DELETE,HEAD,OPTIONS</param-value>
</init-param>
<init-param>
<param-name>allowedHeaders</param-name>
<param-value>*</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>Set Character Encoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>cross-origin</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
0919
- 天地图的能力请求方式:
http://t0.tianditu.gov.cn/vec_c/wmts?tk=989f24f7d561469d99771709bce85875&request=GetCapabilities&service=wmts