geoserver-high-version-some-scale-lose-layer

启动geoserver报错文件找不到

现象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
java.io.FileNotFoundException: src/main/webapp
at org.eclipse.jetty.webapp.WebInfConfiguration.unpack(WebInfConfiguration.java:671)
at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfiguration.java:152)
at org.eclipse.jetty.webapp.WebAppContext.preConfigure(WebAppContext.java:506)
at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:544)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
at org.eclipse.jetty.server.Server.start(Server.java:416)
at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
at org.eclipse.jetty.server.Server.doStart(Server.java:383)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at org.geoserver.web.Start.main(Start.java:125)
九月 15, 2021 11:21:37 上午 org.geoserver.web.Start main
严重: GeoServer startup complete in 0.186s

解决方法

org.geoserver.web.Start#main

​ wah.setWar(“src/web/app/src/main/webapp”);

geoserver 调用wms服务时访问的数据

org.geoserver.wms.GetMap#executeInternal

org.geotools.renderer.lite.StreamingRenderer#drawPlain

org.geotools.data.store.ContentFeatureSource#getReader(org.geotools.data.Query)

org.geoserver.wms.GetMapOutputFormat#produceMap

org.geoserver.wms.map.RenderedImageMapOutputFormat#produceMap(org.geoserver.wms.WMSMapContent, boolean)

renderer.paint(

org.geotools.data.postgis.PostGISDialect#encodeGeometryColumnSimplified

geoserver 在一定版本下出现数据缺失,本地发布的文件没有这种情况,目前只出现在用postgis发布的数据shp图层数据

参考了这个github-issues
https://github.com/AtlasOfLivingAustralia/spatial-hub/issues/66

之前版本查询SQL

1
SELECT "ogc_fid",encode(ST_AsBinary(CASE WHEN ST_HasArc("geom") THEN "geom" ELSE ST_Simplify(ST_Force2D("geom"), 1.71661376953125E-5, true) END),'base64') as "geom" FROM "public"."cg4201061__hhbjx" WHERE "geom" && ST_GeomFromText('POLYGON ((111.91068649291992 32.39775896072388, 111.91068649291992 32.41295099258423, 111.92733764648438 32.41295099258423, 111.92733764648438 32.39775896072388, 111.91068649291992 32.39775896072388))', 4490)

现在geoserver 25.2

1
2
3
4
5
6
7
SELECT
"fid",
encode( ST_AsTWKB ( ST_Simplify ( ST_Force2D ( "geom" ), 3.8116173923015597, TRUE ), 0 ), 'base64' ) AS "geom"
FROM
"public"."qj_temp_gzw"
WHERE
"geom" && ST_GeomFromText ( 'POLYGON ((38371118.635024056 3413740.625232533, 38371118.635024056 3417424.5832218914, 38374191.75154781 3417424.5832218914, 38374191.75154781 3413740.625232533, 38371118.635024056 3413740.625232533))', 4526 )

在老的版本中 加入了判断是否

encode(ST_AsBinary(CASE WHEN ST_HasArc(“geom”) THEN “geom” ELSE ST_Simplify(ST_Force2D(“geom”), 1.71661376953125E-5, true) END),’base64’) as “geom”

是否是如果一个geometry对象或geometry collection包含一个CircularString对象,则返回TRUE这样如果包含圆的geometry会被简化

ST_Simplify() 函数则是通过数据简化 简化太多的圆变成三角形,中间变成八边形

老版本geoserver(2.15)执行SQL的区别

1
2
3
4
5
6
7

-- 对比可以知道 在勾选Support on the fly geometry simplification 后 没有使用ST_Simplify 这个函数在
SELECT "fid",encode(ST_AsBinary(ST_Simplify(ST_Force2D("geom"), 3.8116173982620243, true)),'base64') as "geom" FROM "public"."qj_temp_gzw" WHERE "geom" && ST_GeomFromText('POLYGON ((38371404.953002505 3413497.2549508526, 38371404.953002505 3417181.212940211, 38374478.06952626 3417181.212940211, 38374478.06952626 3413497.2549508526, 38371404.953002505 3413497.2549508526))', 4526) 勾选


SELECT "fid",encode(ST_AsBinary(ST_Force2D("geom")),'base64') as "geom" FROM "public"."qj_temp_gzw" WHERE "geom" && ST_GeomFromText('POLYGON ((38371404.953002505 3413497.2549508526, 38371404.953002505 3417181.212940211, 38374478.06952626 3417181.212940211, 38374478.06952626 3413497.2549508526, 38371404.953002505 3413497.2549508526))', 4526) 不勾选

新版本geoserver(2.19) 执行SQL的区别

1
2
3
4
5
6
7
8
9

-- 对比可以确定 新版本勾选 Support on the fly geometry simplification后 区别在于选用ST_AsTWKB作为简化内容导致的数据缺失
SELECT "fid",encode(ST_AsTWKB(ST_Simplify(ST_Force2D("geom"), 3.8116173923015597, true),0), 'base64') as "geom" FROM "public"."qj_temp_gzw" WHERE "geom" && ST_GeomFromText('POLYGON ((38371404.953002505 3413497.2549508526, 38371404.953002505 3417181.212940211, 38374478.06952626 3417181.212940211, 38374478.06952626 3413497.2549508526, 38371404.953002505 3413497.2549508526))', 4526)


SELECT "fid",encode(ST_AsBinary(ST_Force2D("geom")), 'base64') as "geom" FROM "public"."qj_temp_gzw" WHERE "geom" && ST_GeomFromText('POLYGON ((38371404.953002505 3413497.2549508526, 38371404.953002505 3417181.212940211, 38374478.06952626 3417181.212940211, 38374478.06952626 3413497.2549508526, 38371404.953002505 3413497.2549508526))', 4526)