GeoServer系列之五.WMS地图请求内存限制问题
2015-10-30 13:26
597 查看
应用需求:GeoServer发布WMS地图服务后,需要请求获取一张较大的地图图片,请求地址如下:
[plain] view plaincopyprint?
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=&
bbox=4.528514,4.950175,4.546676,4.958241
&width=7430&height=3300&srs=EPSG:4326&format=image/png
其中,输出的地图图片的高、宽分别为:3300、7430。
问题一:在浏览器中地址栏中回车发送请求后,抛出以下异常,提示地图渲染超过了65536KB的大小限制:
[html] view plaincopyprint?
<pre name="code" class="html"><?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
Rendering request would use 71833KB, whilst the maximum memory allowed is 65536KB
</ServiceException>
</ServiceExceptionReport>
解决一:登录 GeoServer Web Admin Page 管理页面,在左侧的服务中,点击WMS,在右侧把Max rendering memory (KB)的值由65536改为了6553600以确保够用。重新请求即可成功。
问题二:当继续增加请求的图片大小时(高、宽:14860、6600),仍然会抛出异常,请求URL和异常信息如下:
[plain] view plaincopyprint?
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=&
bbox=4.528514,4.950175,4.546676,4.958241
&width=14860&height=6600&srs=EPSG:4326&format=image/png
[html] view plaincopyprint?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
java.lang.NegativeArraySizeException
null
</ServiceException>
</ServiceExceptionReport>
[html] view plaincopyprint?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
java.lang.OutOfMemoryError: Java heap space
Java heap space
</ServiceException>
</ServiceExceptionReport>
解决二:开始菜单 >> Start GeoServer 右键属性,找到 "C:\Program Files (x86)\GeoServer 2.5\bin\startup.bat" ,用记事本打开:
[plain] view plaincopyprint?
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx512m -XX:MaxPermSize=128m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
修改其中的 -Xmx512m -XX:MaxPermSize=128m 部分,修改如下:
[plain] view plaincopyprint?
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx1024m -XX:MaxPermSize=512m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
再次请求地图URL,问题解决。
参考文章:
1. Maximum memory for GetMap request
2. WMS configuration
3. Geoserver/java out of heap space - how do I increase it?
注:经测试,WMS请求的图片大小似乎不能超过10M,原因不明。
[plain] view plaincopyprint?
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=&
bbox=4.528514,4.950175,4.546676,4.958241
&width=7430&height=3300&srs=EPSG:4326&format=image/png
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=& bbox=4.528514,4.950175,4.546676,4.958241 &width=7430&height=3300&srs=EPSG:4326&format=image/png
其中,输出的地图图片的高、宽分别为:3300、7430。
问题一:在浏览器中地址栏中回车发送请求后,抛出以下异常,提示地图渲染超过了65536KB的大小限制:
[html] view plaincopyprint?
<pre name="code" class="html"><?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
Rendering request would use 71833KB, whilst the maximum memory allowed is 65536KB
</ServiceException>
</ServiceExceptionReport>
<pre name="code" class="html"><?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException> Rendering request would use 71833KB, whilst the maximum memory allowed is 65536KB </ServiceException> </ServiceExceptionReport>
解决一:登录 GeoServer Web Admin Page 管理页面,在左侧的服务中,点击WMS,在右侧把Max rendering memory (KB)的值由65536改为了6553600以确保够用。重新请求即可成功。
问题二:当继续增加请求的图片大小时(高、宽:14860、6600),仍然会抛出异常,请求URL和异常信息如下:
[plain] view plaincopyprint?
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=&
bbox=4.528514,4.950175,4.546676,4.958241
&width=14860&height=6600&srs=EPSG:4326&format=image/png
http://localhost:8080/geoserver/wms?service=WMS&version=1.1.0&request=GetMap&layers=campus&styles=& bbox=4.528514,4.950175,4.546676,4.958241 &width=14860&height=6600&srs=EPSG:4326&format=image/png
[html] view plaincopyprint?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
java.lang.NegativeArraySizeException
null
</ServiceException>
</ServiceExceptionReport>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException> java.lang.NegativeArraySizeException null </ServiceException> </ServiceExceptionReport>
[html] view plaincopyprint?
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE ServiceExceptionReport SYSTEM
"http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd">
<ServiceExceptionReport version="1.1.1" >
<ServiceException>
java.lang.OutOfMemoryError: Java heap space
Java heap space
</ServiceException>
</ServiceExceptionReport>
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE ServiceExceptionReport SYSTEM "http://localhost:8080/geoserver/schemas/wms/1.1.1/WMS_exception_1_1_1.dtd"> <ServiceExceptionReport version="1.1.1" > <ServiceException> java.lang.OutOfMemoryError: Java heap space Java heap space </ServiceException> </ServiceExceptionReport>
解决二:开始菜单 >> Start GeoServer 右键属性,找到 "C:\Program Files (x86)\GeoServer 2.5\bin\startup.bat" ,用记事本打开:
[plain] view plaincopyprint?
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx512m -XX:MaxPermSize=128m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx512m -XX:MaxPermSize=128m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
修改其中的 -Xmx512m -XX:MaxPermSize=128m 部分,修改如下:
[plain] view plaincopyprint?
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx1024m -XX:MaxPermSize=512m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
call "C:\Program Files (x86)\Java\jdk1.8.0\bin\java.exe" -DGEOSERVER_DATA_DIR="C:\Program Files (x86)\GeoServer 2.5\data_dir" -Xmx1024m -XX:MaxPermSize=512m -DSTOP.PORT=8079 -DSTOP.KEY=geoserver -Djetty.port=8080 -Djetty.logs="C:\Program Files (x86)\GeoServer 2.5\logs" -jar "C:\Program Files (x86)\GeoServer 2.5\start.jar"
再次请求地图URL,问题解决。
参考文章:
1. Maximum memory for GetMap request
2. WMS configuration
3. Geoserver/java out of heap space - how do I increase it?
注:经测试,WMS请求的图片大小似乎不能超过10M,原因不明。
相关文章推荐
- GIS理论(墨卡托投影、地理坐标系、地面分辨率、地图比例尺、Bing Maps Tile System)
- GeoServer系列之四.基于GeoServer切片地图服务的发布
- ArcGIS desktop+Georeferencing 将JPG格式的图片转化为带地理坐标的TIFF格式
- GeoServer系列之三.发布WMS/WFS服务
- GeoServer系列之一.安装
- OpenLayers-Editbar控件
- OpenLayers-Vector图层Feature选择工具
- IO常用方法
- Linux tcpdump命令详解
- Android ListView异步加载图片错位、重复、闪烁分析以及解决方案
- OpenLayers-添加Marker
- OpenLayers-Vector图层上添加Feature
- OpenLayers-Geometry格式转换
- OpenLayers-绘制图元
- GeoServer系列之二.-设置WMS的显示样式
- OpenLayers-点击查询
- OpenLayers-Map事件
- OpenLayers-加载地图数据(Google Map)
- OpenLayers-第一个程序
- OpenLayers-控件篇