#!/usr/bin/perl use strict; use LWP::Simple; use XML::XPath; ################################################# ##Change the below input variables($search_parameter,$search_platform,$bbox) as needed to generate your own customized kml using those search parameters #the below listed search_parameters are all those currently available my $search_parameter = 'wind_speed,wind_from_direction,wind_gust,air_temperature,air_pressure,sea_surface_temperature,sea_bottom_temperature,salinity,current_speed,current_to_direction,significant_wave_height,dominant_wave_period,water_level'; #for $search_platform acceptable args are: # '' (nothing) to return all platforms # 'carocoops' returns all 'carocoops...' platforms # 'carocoops_FRP2_buoy' returns that single specific platformi # lists of the same above org/platforms format are also acceptable #A full list of platforms available is at http://nautilus.baruch.sc.edu/seacoos_data/CSV/seacoos_station_id.csv my $search_platform = ''; #my $search_platform = 'ndbc_41004_met'; #my $search_platform = 'carocoops_SUN3_buoy'; #my $search_platform = 'carocoops'; #my $search_platform = 'ndbc'; #bbox is is min_x,min_y,min_z,max_x,max_y,max_z where z represents altitude(+) or depth(-) relative to ocean surface my $bbox = ''; #my $bbox = '-81,32,-79,34'; ################################################# #create the xml document from the oostech web service we'll be using to create the kml from my $url = 'http://nautilus.baruch.sc.edu/services/oostech_client.php?method=getLatest¶meter=PARAMETER&platform=PLATFORM&boundingBox=BBOX'; $url =~ s/PARAMETER/$search_parameter/g; $url =~ s/PLATFORM/$search_platform/g; $url =~ s/BBOX/$bbox/g; my $content = getstore($url,"./oostech.xml"); die "Couldn't get $url" unless defined $content; #get rid of oddly placed namespace since it creates problems down the line for XML::LibXML `perl -pi -e 's#xmlns="http://carocoops.org/Demo"##g' oostech.xml`; `cd /var/www/html/gearth; zip oostech.xml.zip oostech.xml`; exit 0;