Polygon buffer - Using pyWPS
Created: 2010-10-26 16:10:14
Last updated: 2010-10-26 16:10:15
Basic example on how to integrate a Web Processing Service (WPS) using PyWPS's WSDL/SOAP
The workflow will accept a GML file with featureCollection where polyon is described using gml:coordinate element structure. This GMl is easely generated with GDAL.
The coodinate structure will be converted to WKT and used to create a polygon using shapely, the output will be a buffer polygon with a defined width.
Output polygon will replace the orginal polygon and the existing XML will be returned as output
THIS IS AN EXPERIMENTAL WORKFLOW TO SHOW TAVERNA WORKING WITH OGC SERVICES
Preview
Run
Run this Workflow in the Taverna Workbench...
Workflow Components
Authors (0)
Titles (0)
Descriptions (0)
Dependencies (0)
Inputs (1)
Name |
Description |
Features |
|
Processors (12)
Name |
Type |
Description |
ExecuteProcess_fastBuffer |
wsdl |
Wsdlhttp://rsg.pml.ac.uk/wps/wps.cgi?wsdlWsdl OperationExecuteProcess_fastBuffer |
ExecuteProcess_fastBuffer_DataInputs |
xmlsplitter |
|
Ask |
localworker |
Scriptimport javax.swing.JOptionPane;
answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (title == void ? null : title), JOptionPane.QUESTION_MESSAGE);
|
message_value |
stringconstant |
ValueValue of buffer |
getResultBuffer |
xpath |
Xpath Expression//*[local-name()='bufferResult']/* |
ExecuteProcess_fastBuffer_2 |
wsdl |
Wsdlhttp://rsg.pml.ac.uk/wps/wps.cgi?wsdlWsdl OperationExecuteProcess_fastBuffer |
ExecuteProcess_fastBuffer_2_DataInputs |
xmlsplitter |
|
Ask_2 |
localworker |
Scriptimport javax.swing.JOptionPane;
answer = JOptionPane.showInputDialog(null, (message == void ? null : message), (title == void ? null : title), JOptionPane.QUESTION_MESSAGE);
|
message_value_1 |
stringconstant |
ValueSecond buffer width |
XPath_Service |
xpath |
Xpath Expression//*[local-name()='bufferResult']/* |
Select_File |
localworker |
Scriptimport java.awt.CardLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
import javax.swing.ImageIcon;
import javax.swing.JEditorPane;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.filechooser.FileFilter;
class FileExtFilter extends FileFilter {
public FileExtFilter(String ext, String label, boolean includeDir) {
this.ext = ext;
this.label = label;
this.includeDir = includeDir;
}
public String getDescription() {
return this.label;
}
public boolean accept(File file) {
if (file.isDirectory() && includeDir) {
return true;
} else {
return file.getName().endsWith(this.ext);
}
}
String ext, label;
boolean includeDir;
}
if (title == void) {
title = null;
}
if ((fileExtensions == void) || (fileExtensions == null)) {
fileExtensions = "";
}
if ((fileExtLabels == void) || (fileExtLabels == null)) {
fileExtLabels = "";
}
JFileChooser chooser = new JFileChooser();
chooser.setDialogTitle(title);
String[] fileTypeList = fileExtensions.split(",");
String[] filterLabelList = fileExtLabels.split(",");
if (fileTypeList != null && filterLabelList != null && fileTypeList.length != filterLabelList.length) {
throw new RuntimeException("The list of extensions and file filter labels must be the same length");
}
// create the file filters
for (int i = 0; i < fileTypeList.length; i++) {
FileExtFilter filter = new FileExtFilter(fileTypeList[i], filterLabelList[i], true);
chooser.setFileFilter(filter);
}
chooser.showOpenDialog(null);
File file = chooser.getSelectedFile();
selectedFile = file.getAbsolutePath();
|
Write_Text_File |
localworker |
ScriptBufferedWriter out = new BufferedWriter(new FileWriter(outputFile));
out.write(filecontents);
out.close();
outputFile = filecontents;
|
Datalinks (13)
Source |
Sink |
ExecuteProcess_fastBuffer_DataInputs:output |
ExecuteProcess_fastBuffer:DataInputs |
Ask:answer |
ExecuteProcess_fastBuffer_DataInputs:width |
Features |
ExecuteProcess_fastBuffer_DataInputs:data |
message_value:value |
Ask:message |
ExecuteProcess_fastBuffer:ProcessOutputs |
getResultBuffer:xml_text |
ExecuteProcess_fastBuffer_2_DataInputs:output |
ExecuteProcess_fastBuffer_2:DataInputs |
getResultBuffer:nodelistAsXML |
ExecuteProcess_fastBuffer_2_DataInputs:data |
Ask_2:answer |
ExecuteProcess_fastBuffer_2_DataInputs:width |
message_value_1:value |
Ask_2:message |
ExecuteProcess_fastBuffer_2:ProcessOutputs |
XPath_Service:xml_text |
XPath_Service:nodelistAsXML |
Write_Text_File:filecontents |
Select_File:selectedFile |
Write_Text_File:outputFile |
ExecuteProcess_fastBuffer:ProcessOutputs |
XMLOut |
Coordinations (2)
Controller |
Target |
ExecuteProcess_fastBuffer_2 |
Select_File |
ExecuteProcess_fastBuffer |
Ask_2 |
Uploader
License
All versions of this Workflow are
licensed under:
Version 1
(of 1)
Credits (1)
(People/Groups)
Attributions (0)
(Workflows/Files)
None
[ edit ]
Shared with Groups (1)
Featured In Packs (0)
None
Log in to add to one of your Packs
Attributed By (0)
(Workflows/Files)
None
Favourited By (0)
No one
Statistics
Other workflows that use similar services
(0)
There are no workflows in myExperiment that use similar services to this Workflow.
Comments (0)
No comments yet
Log in to make a comment