Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
% Specify the process with the process identifier
identifier = 'tidal_predict'

% Specify process inputs
inputs = 'location=POINT(3 52);startdate=2013-08-21 00:00;frequency=HOURLY;enddate=2013-08-29 23:00'

% Pass the required parameters to read the process' meta data
xml = urlread([url '?request=Execute&service=wps&version=1.0.0&identifier=' identifier '&DataInputs=' inputs]);

% Now we have to save the XML file otherwise we can't use xmlread
fid = fopen('file.xml','w');
fwrite(fid, xml);
fclose(fid);

% Read the XML file we just saved
xmldoc = xmlread('file.xml');

% Look up the intersting elements (Processes)
outputs = xmldoc.getElementsByTagName('wps:Output');
output = outputs.item(0);
identifier = output.getElementsByTagName('ows:Identifier').item(0).getFirstChild.getData;

% Look up the output data from the XML
outputdata = output.getElementsByTagName('wps:ComplexData').item(0).getFirstChild.getData;
outputdata = char(outputdata);

% Write output data to table
table = textscan(outputdata(2:end),'%s%f%f%f', 'Delimiter', ',','HeaderLines',1);
dates = table{1};
h = table{2};

% Plot output
plot(datenum(dates),h)
datetick;

Image RemovedImage Added