【发布时间】:2021-02-20 18:56:43
【问题描述】:
我正在后端使用传单和 GeoTools 开发自己的制图服务器,我使用流式渲染在给定的 bbox 中绘制地图,所有几何图形都在 3857 坐标参考系统中,这是来自传单 http:/ 的简单请求/localhost:8080/server/tile/mymap/12/2083/1598.png where z = 12 and x=2083 and y=1598 在后端收到此类请求时,我将 zxy 转换为参考信封,到目前为止一切正常,当我使用SimpleFeatureSource 时,带有 leflet 的前端的结果看起来不错
ReferencedEnvelope env = new ReferencedEnvelope(this.getBounds(tile), this.webMercator);
for (MapLayer mapLayer : mapLayers) {
try {
SimpleFeatureSource featureSource = postgisDataStore.getFeatureSource(mapLayer.getLayer().getSlug());
Style style = createFromSLD(mapLayer);
mapContent.addLayer(new FeatureLayer(source, style));
} catch (IOException e) {
log.error(e.getMessage());
}
}
saveMap(mapContent, os, mapBounds);
结果没有问题:
但是当我使用FeatureCollection 而不是SimpleFeatureSource 时,我遇到了点问题,它们以某种方式被裁剪,有人可以解释发生了什么吗:
ReferencedEnvelope env = new ReferencedEnvelope(this.getBounds(tile), this.webMercator);
for (MapLayer mapLayer : mapLayers) {
try {
SimpleFeatureCollection fc = featureService.getTile(mapLayer.getLayer(), tile, env);
Style style = createFromSLD(mapLayer);
mapContent.addLayer(new FeatureLayer(source, style));
} catch (IOException e) {
log.error(e.getMessage());
}
}
saveMap(mapContent, os, mapBounds);
【问题讨论】: