示例#1
0
    def get(self, urls, inputs):
        file = urls.split(";")[0]
        base = os.path.basename(file)
        host = urls.split(";")[1]
        workspace = inputs.split(";")[0]
        projection = inputs.split(";")[1]
        username = inputs.split(";")[2]
        password = inputs.split(";")[3]
        style = os.path.splitext(base)[0]
        r = utils.generateSLD(file, os.path.splitext(base)[0])
        jarfilePath = "C:\GeoServerJavaApp\PublishStyle.jar"
        publishcommand = 'java -jar ' + jarfilePath + ' ' + r + ' ' + host + ' ' + workspace + ' ' + style + ' ' + username + ' ' + password
        os.system(publishcommand)
        style = workspace + ":" + style
        os.remove(r)

        jarfilePath = "C:\GeoServerJavaApp\PublishRaster.jar"
        publishcommand = 'java -jar ' + jarfilePath + ' ' + file + ' ' + host + ' ' + workspace + ' ' + style + ' ' + username + ' ' + password + ' ' + projection
        os.system(publishcommand)
        extent = utils.getExtent(file)
        return {
            "extent": extent,
            "layer": workspace + ":" + os.path.splitext(base)[0]
        }