Changes between Version 16 and Version 17 of NERCPortals


Ignore:
Timestamp:
18/03/08 15:50:43 (11 years ago)
Author:
mkochan
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NERCPortals

    v16 v17  
    2626python wms2kml.py filename.conf.xml 
    2727}}} 
    28 where {{{filename.conf.xml}}} is an XML config file, whose format is described in the section "Configuration". 
     28where {{{filename.conf.xml}}} stands for an XML config file. 
    2929 
    3030The script interrogates a WMS web service using the {{{GetCapabilities}}} call and thus acquires a <wms:Capabilities> XML document from it, which contains description of WMS layers served by the WMS web service. Then, it exports this into a hierarchy of embedded directories forming a structure which contains a hierarchy of expandable KMZ documents linked together using the ''<kml:NetworkLink>'' tag, and loaded on demand. The files can then be served to the outer world via HTTP. 
    3131 
     32An example format of the config file is as follows (example config files can be found in the egg's {{{csml2kml/config}}} sub-directory): 
     33{{{ 
     34<WMSLayers2KML> 
     35  <WMSRequest> 
     36    <URL>http://www-devel.ipcc-data.org/maps/wms/obs</URL> 
     37    <ServiceVersion>1.1.1</ServiceVersion> 
     38    <ImageFormat>image/png</ImageFormat> 
     39    <ImageWidth>960</ImageWidth> 
     40    <ImageHeight>480</ImageHeight> 
     41    <CRS>EPSG:4326</CRS> 
     42  </WMSRequest> 
     43  <OutputRootDirectory>/home/users/mkochan/svn-root/kml/csml2kml/output/wms-obs2</OutputRootDirectory> 
     44  <ServerRootDirectory>http://bond.badc.rl.ac.uk:8089</ServerRootDirectory> 
     45</WMSLayers2KML> 
     46}}} 
     47The field {{{URL}}} is a base URL of the WMS web service serving the intended dataset. 
     48 
    3249==== The {{{stations2kml.py}}} script ==== 
    3350 
     51Run this script as: 
     52{{{ 
     53python stations2kml.py filename.conf.xml 
     54}}} 
     55where {{{filename.conf.xml}}} stands for an XML config file. 
    3456 
     57This script interrogates a WFS to get a list of (meteorological) stations, recorded using an element ''<np:Station>'' defined for the purposes of this project. It generates a KMZ file that contains a number of ''<kml:Placemark>'' elements, each standing for a single station. Each station has has a balloon filled according to a defined template, which refers to a URL of the running {{{csml2kmlpylon}}} Pylon. Thus dynamic content about each station can be presented. 
     58 
     59An example config file looks as follows: 
     60{{{ 
     61<Stations2KML> 
     62  <DocumentName>MIDAS stations (first 100 of them)</DocumentName> 
     63  <UseRegions>yes</UseRegions> 
     64  <GetAllStationsRequestURL><![CDATA[http://130.246.76.98:8084/geoserver/wfs?request=getFeature&service=wfs&version=1.1.0&typ 
     65ename=np:Station&maxFeatures=100]]></GetAllStationsRequestURL> 
     66  <BalloonTemplate>&lt;h2&gt;Station $[station_name]&lt;/h2&gt;Click here to see the list of &lt;a href=&quot;http://bond.badc.rl.ac.uk:8089/csmlGrapher/list?station_name=$[station_name]&quot;&gt;CSML features associated with this station&lt;/a&gt; (this will open a window of your default web browser).</BalloonTemplate> 
     67  <StationData> 
     68    <Datum name="station_id">#ID#</Datum> 
     69    <Datum name="station_name">#NAME#</Datum> 
     70  </StationData> 
     71   <OutputKmzFilename>/home/users/mkochan/svn-root/kml/csml2kml/output/exampleps_stations.4.kmz</OutputKmzFilename> 
     72</Stations2KML> 
     73}}} 
     74The non-obvious settings are as follows: 
     75 - {{{UseRegions}}} - determines whether to use embedding into regions. 
     76   * If set to {{{no}}}, stations will be recorded simply as a list of KML placemarks, and will be visible from all altitudes. May cause slow rendering for large number of placemarks. 
     77   * If set to {{{yes}}}, stations will be divided by recursively splitting the the covered are into 4 smaller KML regions. The actual station KML placemarks will be placed at the bottom of the hierarchy. Therefore, they will be forced to be visible only for closer zooms onto the ground, so rendering will be quick. 
    3578 
    3679=== Deployment of the {{{csml2kmlpylon}}} server === 
    37  
    38  
    39  
    40 === Configuration === 
    4180 
    4281== Code notes == 
     
    4786 - {{{scripts}}} - contains Python stand-alone scripts, runnable from command line, which both use a config file as a means of input 
    4887 - {{{tests}}} - contains tests, which simply print output (rather than fail/pass messages), and are runnable as {{{python test_filename.py}}}, but please look at the contents first to see what the test does 
    49  - {{{config}}} - contains config files for the scripts, in XML format, which define locations of used Web services etc. 
     88 - {{{config}}} - a preferred location for config files for the scripts, in XML format, which define locations of used Web services etc. 
    5089 - {{{output}}} - empty after installation, optionally usable for output of scripts and tests 
    5190