Ignore:
Timestamp:
01/02/08 15:24:40 (12 years ago)
Author:
mkochan
Message:

Made other prototypes use KMLDocument-encapsulated functionality. Tested using these prototypes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • DPPP/kml/csml2kml/python/prototypes/buildPointSeriesWithReferencedPlotsUsingGeoServerOO.py

    r3289 r3291  
    66import urllib 
    77 
    8 from KMLDocument import KMLDocument, KMLStyle, KMLPlacemark, getBasicKMLStyle 
     8from KMLDocument import * 
    99 
    1010# -------------------------------------------------------------------------------------------------------------------------- 
     
    2727def parseGMLStationsCollection(textGml): 
    2828    ''' 
    29     A generator method. Parse the GML returned from GeoServer and yield tuples containing information 
    30     (gml_id, name, lon, lat) about each station. 
     29    Parse the GML returned from GeoServer and yield tuples containing information (gml_id, name, lon, lat) 
     30    about each station. 
    3131    ''' 
    3232    root = XML(textGml) 
     
    4141 
    4242# -------------------------------------------------------------------------------------------------------------------------- 
     43# 
     44# [NOTE] At the moment, since the <Station> GML-feature element does not contain a list of CSML features, 
     45#        the output of this code is not entirely correct. In particular, the HTTP reference to the grapher web-service 
     46#        cannot be correctly determined. 
    4347 
    4448url = 'http://bond.badc.rl.ac.uk:8089/dummyGeoServer/GetStationCSMLFeatures?gml_id=MIDAS_Stations' 
     
    4953eachStationData = {'feature_id': '#ID#'} 
    5054 
    51 basicKmlStyle = getBasicKMLStyle(balloonTemplate) 
    52 kmlDocument = KMLDocument('MIDAS stations (example)', basicKmlStyle) 
     55placemarkKmlStyle = createDefaultPlacemarKMLStyle(balloonTemplate = balloonTemplate) 
     56kmlDocument = KMLDocument('MIDAS stations (example)', [placemarkKmlStyle]) 
    5357 
    5458generator =  parseGMLStationsCollection(textGml) 
    5559for (gml_id, name, lon, lat) in generator: 
    5660    print 'Station %s ("%s"): @ (%f,%f)' %  (gml_id, name, lon, lat) 
    57     kmlStation = KMLPlacemark(gml_id, name, lon, lat, data=eachStationData) 
    58     kmlDocument.appendElement(kmlStation.build()) 
     61    kmlStation = KMLPlacemark(gml_id, name, lon, lat, styleID = placemarkKmlStyle.id, data = eachStationData) 
     62    kmlDocument.elements.append(kmlStation) 
     63 
    5964kmlDocument.save('./../../output/exampleps_stations.kml') 
Note: See TracChangeset for help on using the changeset viewer.