GeoServer WMS地图请求内存限制问题

GeoServer发布WMS地图服务后,需要请求获取 一张较大的地图图片,请求地址如下:

?

1

2

3

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的大小限制:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

<pre name="code" class="html"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?--

<serviceexceptionreport version="1.1.1">    

<serviceexception> 

Rendering request would use 71833KB, whilst the maximum memory allowed is 65536KB

</serviceexception>

</serviceexceptionreport>

</pre>

 

解决一:登录 GeoServer Web Admin Page 管理页面,在左侧的服务中,点击WMS,在右侧把Max rendering memory (KB)的值由65536改为了

6553600以确保够用。重新请求即可成功。

问题二:当继续增加请求的图片大小时(高、宽:148606600),仍然会抛出异常,请求URL和异常信息如下:

 

<pre class="brush:py">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 

</pre>

 

<pre class="brush:py"><!--?xml version="1.0" encoding="UTF-8" standalone="no"?--

    

<serviceexceptionreport version="1.1.1">    

<serviceexception> 

      java.lang.NegativeArraySizeException 

null 

</serviceexception> 

</serviceexceptionreport>

</pre>

 

解决二:开始菜单 >> Start GeoServer 右键属性,找到

"C:\Program Files (x86)\GeoServer 2.5\bin\startup.bat" ,用记事本打开:

 

<pre class="brush:py">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" 

</pre>

 

修改其中的  -Xmx512m -XX:MaxPermSize=128m 部分,修改如下:

 

<pre class="brush:py">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" 

</pre>

 

再次请求地图URL,问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值