Wuiw Development

From PyWPS wiki

Jump to: navigation, search

we are trying to avoid server scripting as much as possible,

we've seen that WPS can accept external url as datasources and cache them,

we've mounted a WCS and WFS to serve raster (DEM) and vector layers

we are trying to made a process that use WCS to define maf infos and WPS to create output

Contents

[edit] Interface sequence

  • the interface shows you just a WPS selector
  • you choose a server
  • server offers some funtions
  • you choose one function
  • interface ask you for datasources depending on what that function need to work
  • once you choose a datasource, mapinfos are kept form GetCapabilities
  • other form inputs are created on the fly depending on function requirements
  • as we have an extent we can track mouse clicks on the map
  • then execute button will ask pywps to donwload datasources and do the process
  • interface wait until pywps end the process and back the output
    • at this stage, process should be called to run assynchronously and wuiw should regulary check for it's status
  • if process is ok image il placed intead of map
  • otherwise error is shown
  • end

[edit] General notes to extra definitions

After release 1.0.0 we've seen the need for a Metadata definition system

Examples:

  • [[combobox]] - comboboxes
  • [[mappoint]] - for point defined by clicking in the map with the mouse
  • ...

Details in the samples below.

[edit] metadata discussion

We'll use Metadata definition to pass this informations in the process description.

The definition will pass between a key:value set.


metadata definition
       self.Metadata = [
               {
                   "Identifier":"point",
                   "type":"point",
                   "textContent":"Click in the map"
               },
        ]


expected metadata
               <ows:Metadata Identifier="point" type="point">
                       Click in the map
               </ows:Metadata>
NOTES
mandatory attributes for form definition is "interfaceType"="formField" and in this case a "identifier" attribute have to define the related Input value.

[edit] input types discussion

List and notes

[edit] Common attributes

  • identifier - the input resource identifier
  • visible -- togle visibility of the form input (e.g. for debuging)
  • Description (should be taken from Description of the process input
  • tip -- tool tip for the mouse
  • cursor -- mouse cursor style

[edit] Maparea inputs

  • Points -- Array of x,y coordinates. You need "Reset" button and specify if one or many points can be stored.
  • Line -- This is just special case of Points. Number of coordinate pairs in the array must be > 2.
  • Polyline -- Special case of Line. Number of coordinate pairs in the array must be > 3. It is assumed, that the application (whether client or server) will have to take care on closing the polygon.
  • BoundingBox -- Drag'n'Drop method or acutal extent

[edit] Other inputs

we should choose between HTML alike and General UI inputs.

[edit] HTML alike inputs

Faster implementation. Easier to be interpretated by HTML ready developers.

<input type="??" />
  • text -- If no metadata were specified, this is the default input type.
  • checkbox -- Choose many
  • radio -- Choose one
  • textarea -- Larger text inputs. Can be omited for the first time.
  • select -- This is only spefial case for checkbox or radio. Can be omited for the first time.

[edit] General UI inputs

general purpose. This should allow an easier implementation of plug-in for QGIS or other application. Naturally even Wuiw would stick to this definitions.

inspired by: http://web.mit.edu/qt-dynamic_v4.1/www/qstyle.html

I'm not sure about values implementation. I don't now if it's good to use a comma separated value or a different separator. --Ominiverdi 21:21, 13 November 2006 (CET)

  • ComboBox
    • values (string) key::value separator ="||"
    • currentIndex - default: 0
    • multipleValues (bool) default: false
  • Slider
    • setInitValue
    • setInterval
  • CheckBox
    • value (string) key::value
    • defaultStatus (bool) default: false
  • RadioButton
    • values (string) key::value separator ="||"
  • textInput
    • can we ask for a type? (string,int,double,...)

[edit] Process Configuration

Here below all Inputs we need to define the input form interface. We should define input types to let javascript API interprete this values and create the desired form fields.

[edit] datasources

  • are WCS for raster layer and WFS for vector layer enough?
  • is there a way to accept more then one Format?
    • es: for geoTiff input we can have "image/tiff" or "image/ecw" (maybe others?!?)

[edit] Raster layer

example to import an external raster layer:

{
 ’Identifier’:’input_dem_url’,
    ’Title’: ’Input DEM remote resource’,
    ’ComplexValue’: {
           ’Formats’: [ "image/tiff" ]
    },
},

This example stands for ComplexValue and ComplexValueReference input types.

[edit] Vector Layer

example to import an external vector layer:

{
   ’Identifier’:’vector’,
   ’Title’: ’Input vector layer’,
   ’Abstract’:  "This vector layer should be a WMS feature",
   ’ComplexValue’: {
         ’Formats’: [ "text/xml" ]
    },
},

This example stands for ComplexValue and ComplexValueReference input types.

[edit] map info

map image dimension actually is fixed at 640*480 but can be eventually configured in the OWS request

[edit] extent

Example of BoundingBoxValue input: BoundingBoxValue provides possibility define your region borders.

{
    ’Identifier’:’bbox’,
    ’Title’: ’Bounding box’,
    ’Abstract’: "Bounding box",
    ’BoundingBoxValue’: {},
},

[edit] points

  • how many clicked points do we need?
  • what coords?
{
    ’Identifier’:’points’,
    ’Title’: ’insert 2 points’,
    ’Abstract’: "best path between two points",
    ...
},
metadata definition
       self.Metadata = [
               {
                   "Identifier":"points", 
                   "type":"points", #wuiw will interprete this value and look for pointsNumber vaue
                   "pointsNumber":"2", #the ammount of points the function requests
                   "description":"Click two point to get the path" #the text to show in the Wuiw interface
                   "textContent":"Click two point to get the path" #not needed for WUIW
               },
        ]


expected metadata
               <ows:Metadata Identifier="points" type="points" description="Click two point to get the path">
                       Click two point to get the path
               </ows:Metadata>

If we would use GML, the data type could be ComplexValue --Jachym 13:54, 10 November 2006 (CET)

[edit] unit

  • do we need to know the unit?

[edit] additional fields

all kind of different fields to be rendered in the User Interface.

[edit] integer

  • how to define the request for a integer? (this must be easy)
    • es: 9 [cows]  ;-)
{
    ’Identifier’:’integer’,
    ’Title’: ’give me the exact value of how many cows you want to put in that field ’,
    ’Abstract’: "set an integer value",
    ’LiteralValue’: {
       ’values’:["*"]
       'UOMs':["None"],
       ’dataType’: type(0),
     }
},

Use

"dataType": type(0.0) 

for floating points and

"dataType": type("")

for strings.

[edit] Metadata

expected metadata:

<Metadata identifier="startingpoint" type="point">hallo, world</Metadata>

process definition:

self.Metadata = [{"name":"jachym","value":"is good boy"},{"name":"lorenzo","value":"is better"}]

[edit] interval

  • how to define the request for a interval?
{
    ’Identifier’:’slider’,
    ’Title’: ’values bewteen 1 and 1000 ’,
    ’Abstract’: "distance in mt from your target",
    ...
},

[edit] combobox

  • how to define the request for a combobox (select) or multicombobox (the second one allow multiple choices)
  • es: choose between 8,14,20,45
  • es: choose between america, africa, asia, oceania (you can choose 1 or more)
# definition
{
    ’Identifier’:’combobox’,
    ’Title’: ’choose between this value: ’,
    ’Abstract’: "select the maximum inclination percentage for your field. [[combobox]]",
    'LiteralValue': {values:[8,14,20,45]}
    ...
},
# setting abstract the automatic way
for val in self.Inputs[-1]["LiteralValue"]["values"]:
    self.Inputs[-1]["Abstract"] += val+","

{
    ’Identifier’:’multicombobox’,
    ’Title’: ’choose at least one between: red, green, blu, magenta’,
    ’Abstract’: "I really don't know if some functions of GRASS can need this. [[multicombobox]]",
    ...
},

[edit] Proxy

AJAX call soffer of a very known limitation of url request. JS cannot access URLs outside the script domain.

actually Wuiw is using a proxy in php. Nothing to be proud of, as developer, but useful to his mission.

web/wuiw/tools/proxy/proxy_xml.php
header("Content-Type:text/xml");
if($lines = file($wpsURL)){
	$string = implode(, $lines);
	echo $string;
 } else {
	echo '<?xml version="1.0" ?><error>connection problem</error>';
}

and

web/wuiw/tools/proxy/proxy_mime.php
 	header("Content-Type:image/png");
	@readfile($wpsURL) OR die('<?xml version="1.0" ?><error>readfile problem</error>');

the two files are wroten as this because some limits of php maintaning the mime type of the remote file.

Personal tools