#--*--coding:utf-8--*-- #使用说明: #只需要调用下面的autoPush这个函数,修改里面的两个参数 #参数说明:geoserverWorkeName为geoserver工作空间名称,fileName为tif存放文件夹名称 import os def autoPush(geoserverWorkeName,fileName): namespace = geoserverWorkeName # 要发布的文件夹名称 train_path = fileName # 遍历文件夹中为.tif后缀的文件,获取其路径 tif_list = [os.path.join(train_path, i) for i in os.listdir(train_path) if i.endswith('.tif')] for onetif in tif_list: fpname=onetif fname = os.path.split(fpname)[-1] #获取每个tif的名字 # os.system('curl -v -u admin:geoserver -XPOST -H "Content-type: text/xml" -d "<workspace><name>'+namespace+'</name></workspace>" http://localhost:8080/geoserver/rest/workspaces') # 发布tif os.system('curl -u admin:geoserver -XPUT -H "Content-type:image/tiff" --data-binary @'+fpname+' http://localhost:8080/geoserver/rest/work
python用geoserver自动发布tif数据
最新推荐文章于 2024-05-20 17:34:45 发布