PageRenderTime 5ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/edl-scripts/ingest.py

http://alageospatialportal.googlecode.com/
Python | 29 lines | 9 code | 8 blank | 12 comment | 6 complexity | 3e59bec1e74886541538dd55ff954cf8 MD5 | raw file
 1#!/usr/bin/python
 2
 3#from geoserver.catalog import Catalog
 4
 5
 6#tiffdata = {'tiff':'/mnt/transfer/MCAS_1k_Datapack/Climate/erosivity.tif'}
 7
 8
 9#tiffdata = {
10#      'tiff': '/home/angus/dwins-gsconfig.py-7000eaa/test/data/Pk50095.tif',
11#      'tfw':  '/home/angus/dwins-gsconfig.py-7000eaa/test/data/Pk50095.tfw',
12#      'prj':  '/home/angus/dwins-gsconfig.py-7000eaa/test/data/Pk50095.prj'
13#    }
14
15#ala = cat.get_workspace("ALA")
16#cat.create_coveragestore("test", tiffdata, ala)
17#if(cat.get_resource("test", workspace=ala) is not None):
18#	print("woot")
19
20import os
21import edlconfig
22
23for root, dirs, files in os.walk(edlconfig.dataset):
24	for name in files:
25		if ".tif" in name:
26			layername = edlconfig.source + "_" + name.replace(".tif","")
27			request = "curl -u " + edlconfig.geoserver_userpass + " -XPUT -H \"image/tif\" --data-binary @" + os.path.join(root,name) + " " + edlconfig.geoserver_url + "/geoserver/rest/workspaces/ALA/coveragestores/" + layername + "/file.geotiff"
28			print(request)
29			os.system(request)