Changes between Version 11 and Version 12 of NERCPortals


Ignore:
Timestamp:
18/03/08 12:27:52 (11 years ago)
Author:
mkochan
Comment:

Created new text structure

Legend:

Unmodified
Added
Removed
Modified
  • NERCPortals

    v11 v12  
    1212Currently only CSML documents containing solely <csml:GridSeriesFeature> and <csml:PointSeriesFeature> elements are supported. 
    1313 
    14 The functionality is split into two eggs: 
     14The functionality is split into two eggs/projects: 
    1515 - {{{csml2kml}}} - provides static functionality, with the output being KML stored in files (*.kml, *.kmz), 
    1616 - {{{csml2kmlpylon}}} - is a web server (to be run by the BADC) providing web services which bring dynamic content to the viewing experience in Google Earth via HTTP. 
    1717 
     18== Installation of eggs == 
    1819 
    19 == The module {{{KMLDocument.py}}} == 
     20... 
    2021 
    21 Encapsulation of a KML document is achieved via the module {{{KMLDocument.py}}}. The whole KML document 
    22 can be contained in an {{{KMLDocument.KMLDocument}}} object; this object in turn contains objects derived 
    23 from class {{{KMLDocument.KMLElement}}}. Once a {{{KMLDocument}}} object has been generated, 
    24 it can be saved into a file using the method {{{KMLDocument.save()}}} -- actual KML is generated only 
    25 during saving. 
     22== Code notes == 
    2623 
    27 == The class {{{GridSeriesConvertor}}} == 
    2824 
    29 Example test is contained in {{{kml/csml2kml/python/csml2kml/tests/testGridSeriesConvertor.py}}}.  
    30 This test reads in the climate modelling file {{{clim_10.csml}}} with month/decade values for various 
    31 csml:GridSeriesFeature's. The CSML file does not contain the grid data themselves -- these are read in from WMS. 
    32 Since this information is not part of the CSML file, there must be a config file supplied as well, 
    33 which contains the context for the conversion. Its format is as follows: 
    34 {{{ 
    35 <CSML2KMLConfig> 
    36   <CSMLGridSeriesFeatureWMSRequest> 
    37     <URL>http://www-devel.ipcc-data.org/maps/wms/obs</URL> 
    38     <ServiceVersion>1.1.1</ServiceVersion> 
    39     <ImageFormat>image/png</ImageFormat> 
    40     <ImageWidth>960</ImageWidth> 
    41     <ImageHeight>480</ImageHeight> 
    42     <CRS>EPSG:4326</CRS> 
    43     <LayerName>#FILENAME_EXCL_SUFFIX#/#FEATURE_NAME#</LayerName> 
    44     <LongitudeBounds>UNCONSTRAINED</LongitudeBounds> 
    45     <LatitudeBounds>UNCONSTRAINED</LatitudeBounds> 
    46   </CSMLGridSeriesFeatureWMSRequest> 
    47   <View name="Whole century"> 
    48     <SplitTimeStepsBy></SplitTimeStepsBy> 
    49     <LogicalDateTimeTransform>20_CENTURY_DECADE</LogicalDateTimeTransform> 
    50     <LogicalDateTimeDelta>MONTH_HENCE</LogicalDateTimeDelta> 
    51   </View> 
    52   <View name="Compare decades"> 
    53     <SplitTimeStepsBy>year</SplitTimeStepsBy> 
    54     <CategoryNamingPattern>Decade of #VERBATIM#</CategoryNamingPattern> 
    55     <LogicalDateTimeTransform>FIRST_DAY_OF_MONTH</LogicalDateTimeTransform> 
    56     <LogicalDateTimeDelta>MONTH_HENCE</LogicalDateTimeDelta> 
    57   </View> 
    58   <View name="Compare months"> 
    59     <SplitTimeStepsBy>month</SplitTimeStepsBy> 
    60     <CategoryNamingPattern>#MONTH#</CategoryNamingPattern> 
    61     <LogicalDateTimeTransform>FIRST_DAY_OF_MONTH</LogicalDateTimeTransform> 
    62     <LogicalDateTimeDelta>DECADE_HENCE</LogicalDateTimeDelta> 
    63   </View> 
    64 </CSML2KMLConfig> 
    65 }}} 
    66 The {{{CSMLGridSeriesFeatureWMSRequest}}} element contains information about the WMS to be used 
    67 from retrieval. Each {{{View}}} element describes a different way of viewing the data, 
    68 i.e. how they should be organized in Google Earth's left panel. This also determines how they can be animated. 
     25=== Code notes towards {{{csml2kml}}}  === 
    6926 
    70 The code for csml:GridSeriesFeature's conversion is organised in the following modules: 
    71  - {{{GridSeriesConvertor.py}}} -- contains class {{{GridSeriesConvertor}}} which performs the conversion 
    72  - {{{csmlwrappers.py}}} -- contains wrapper classes which wrap around various CSML features. 
    73    Currently there is only class {{{GridSeriesFeatureWrapper}}}. 
    74  - {{{kmlfeatures.py}}} -- encapsulation of CSML features as KML elements. Does not use {{{KMLDocument}}} 
    75    and is only used by {{{GridSeriesConvertor}}}. 
     27=== Code notes towards {{{csml2kmlpylon}}}  === 
    7628 
    77 == The module {{{StationConvertor.py}}} == 
    78  
    79 Example run is contained in {{{kml/csml2kml/python/csml2kml/tests/testStationConvertor.py}}}. 
    80 This test reads in a GML document from an arbitrary URL (which normally is a GeoServer call). 
    81 It also requires a configuration object, which sets context for the conversion. 
    82 The format of input is not CSML, but rather XML derived from GML that specifies locations 
    83 of meteorological stations; each station can have several csml:PointSeriesFeature's associated with it: 
    84 {{{ 
    85 <?xml version="1.0" encoding="UTF-8"?> 
    86 <gml:FeatureCollection xmlns="http://ndg.nerc.ac.uk/np" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="..." gml:id="MIDAS_Stations"> 
    87         <gml:featureMember> 
    88                 <Station gml:id="midas.station.1600"> 
    89                         <stationName>GAN, MALDIVE IS</stationName> 
    90                         <stationID>1600</stationID> 
    91                         <location> 
    92                                 <gml:Point gml:id="midas.station.1600.point"> 
    93                                         <gml:pos>73.15 0.683</gml:pos> 
    94  
    95                                 </gml:Point> 
    96                         </location> 
    97                 </Station> 
    98         </gml:featureMember> 
    99         <gml:featureMember> 
    100                 <Station gml:id="midas.station.17708"> 
    101                   ... 
    102                 </Station> 
    103         </gml:featureMember> 
    104         <gml:featureMember> 
    105                 <Station gml:id="midas.station.18008"> 
    106                   ... 
    107                 </Station> 
    108         </gml:featureMember> 
    109 </gml:FeatureCollection> 
    110 }}} 
    111  
    112 Note: The same server should return CSML of individual CSML features for any station. 
    113 At the moment, how exactly this will be done is a matter of debate. 
    114  
    115 The configuration is obtained from a config file which has format similar to this: 
    116 {{{ 
    117 <CSML2KMLConfig> 
    118   <CSMLStationPointSeries> 
    119     <name>MIDAS stations (example)</name> 
    120     <UseRegions>yes</UseRegions> 
    121     <GeoServerRequest> 
    122       <URL>http://bond.badc.rl.ac.uk:8089/dummyGeoServer/GetStationCSMLFeatures?gml_id=MIDAS_Stations</URL> 
    123       <BalloonTemplate>&lt;img src="http://bond.badc.rl.ac.uk:8089/csmlGrapher/plot?feature_id=$[feature_id]"&gt;</BalloonTemplate> 
    124       <StationData> 
    125         <Datum name="feature_id">#ID#</Datum> 
    126       </StationData> 
    127     </GeoServerRequest> 
    128   </CSMLStationPointSeries> 
    129 </CSML2KMLConfig> 
    130 }}} 
    131 The element {{{GeoServerRequest}}} determines how stations list should be obtained (from which URL) 
    132 and how information on each station should be shown in a balloon that pops out in Google Earth when a station 
    133 is clicked. Each station can how certain data associated with it, which are substituted into the template. 
    134 Using the {{{#ID#}}} value will in turn be substituted by the individual feature's ID. 
    135  
    136 === Support for KML regions === 
    137  
    138 If all stations were visible in Google Earth at the same time, the rendering would be very slow. 
    139 It is therefore possible in Google Earth to organise stations (represented by kml:Placemark elements) into a hierarchical structure of regions using the kml:Folder and kml:Region tags that causes stations to be rendered only for closer zooms onto the ground (http://code.google.com/apis/kml/documentation/regions.html#nestingregions). 
    140  
    141 Therefore, when the config-file tag {{{UseRegions}}} is set to "yes", the convertor will generate a KML document which will contain all stations contained in a single folder, with hierarchy of regions inside. 
    142  
    143 Codewise, the process performed two steps:  
    144  - First, 2D globe space gets split into 4 smaller regions, and this is repeated recursively, until a small number of stations (10) are present in the current (low-level) region. Thus a so-called quad-tree is constructed (quad = each node has 4 children) which contains the hierarchy, with actual stations as leaves. The quad-tree functionality is contained in the module {{{QuadTree.py}}}. Thus, a {{{QuadTree.QuadTree}}} object is constructed. 
    145  - Second, the {{{QuadTree}}} object is "translated" into a {{{KMLDocument}}} object.