geoserver发布切片影像地图

问题来源

拿到一副经过校正后的影像后,怎么使用geoserver进行切片及发布呢。本人研究了一番在此给出答案。

导入tiff影像

这个就不说了,网上一大把教程,记得要带坐标系。
若使用imagemosaic导入时,记得在arcgis里生成镶嵌集,再将边界放到同一个文件夹内进行geoserver的导入(省去合成的时间)

进行切片

这里要注意一个问题,如果打开TileLayers界面显示403,要记得去日志查看问题,及时调整,或者真的没问题时可选择重启一下,有时GWC容易抽风。
第二个问题是,如果打开DiskQuota出现配置不同步的情况(Loading quota store failed, the disk quota subsystem is disabled, please…),注意提示的图层id,去基目录下的gwc及gwc-layers查看是否有同id的XML,及时删除。

利用openlayer进行查看

  • 切片后地址怎么找,很多人会认为是gwc/service/wms,但wms服务的动态加载属性明显不适用于瓦片,到底真正的地址在哪里?首先我们要想到瓦片图层用的基本就是TMS/WMTS,所以我们可以考虑到TMS,而且在geoserver的首页,有tms的入口。可以看到大概的地址是localhost:8080/service/tms/1.0.0/你的图层@EPSG%3A4326@png,后面加上/{z}/{x}/{y}.png就是最终服务。

  • ol3的代码注意要设定好tile的属性,设置tile后不能直接用url,要在tileUrlFunction中进行url的拼接,因为直接用url,那之前的tile设置等同于白做,这里列出4326的调用方式
var testLayer = new ol.layer.Tile({
    	extent: [107.33028,22.19812,107.34037,22.22218],
		source:new ol.source.XYZ({
			projection: ol.proj.get('EPSG:4326'),
			maxZoom: 21,
			minZoom: 0,
			tileGrid: new ol.tilegrid.TileGrid({
				extent: ol.proj.get('EPSG:4326').getExtent(),
				origin: [-180,-90],
				resolutions: [0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.001373291015625,0.0006866455078125,0.00034332275390625,0.000171661376953125,0.0000858306884765625,0.00004291534423828125,0.000021457672119140625,0.000010728836059570312,0.000005364418029785156,0.000002682209014892578,0.000001341104507446289,6.705522537231445e-7,3.3527612686157227e-7],
			}),
			tileUrlFunction: function(tileCoord){
				var z = tileCoord[0];
				var x = tileCoord[1];
				var y = tileCoord[2];
				return'http://localhost:8080/geoserver/gwc/service/tms/1.0.0/图层名@EPSG%3A4326@png/'+z+'/'+x+'/'+y+'.png'
			}
		})
	});

转载自:https://blog.csdn.net/u013323965/article/details/70910576

You may also like...