[mapserver-commits] r9974 - in sandbox/ms_ogc_cite: . wcs-1.0.0 wcs-1.0.0/bin wcs-1.0.0/map wcs-1.0.0/map/graphics wcs-1.0.0/perl

svn at osgeo.org svn at osgeo.org
Mon Mar 22 13:51:02 EDT 2010


Author: nsavard
Date: 2010-03-22 13:51:02 -0400 (Mon, 22 Mar 2010)
New Revision: 9974

Added:
   sandbox/ms_ogc_cite/wcs-1.0.0/
   sandbox/ms_ogc_cite/wcs-1.0.0/bin/
   sandbox/ms_ogc_cite/wcs-1.0.0/bin/mswcs100_ogc_cite
   sandbox/ms_ogc_cite/wcs-1.0.0/data
   sandbox/ms_ogc_cite/wcs-1.0.0/map/
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/e.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/n.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/ne.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/nw.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.png
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/s.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/se.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/sw.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/w.gif
   sandbox/ms_ogc_cite/wcs-1.0.0/map/ms_ogc_cite_wcs100.map
   sandbox/ms_ogc_cite/wcs-1.0.0/map/template.html
   sandbox/ms_ogc_cite/wcs-1.0.0/perl/
   sandbox/ms_ogc_cite/wcs-1.0.0/perl/common.pl
   sandbox/ms_ogc_cite/wcs-1.0.0/perl/extractdate.pl
   sandbox/ms_ogc_cite/wcs-1.0.0/perl/mkhdr.pl
   sandbox/ms_ogc_cite/wcs-1.0.0/perl/rename.pl
Log:
Initial revision.

Added: sandbox/ms_ogc_cite/wcs-1.0.0/bin/mswcs100_ogc_cite
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/bin/mswcs100_ogc_cite	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/bin/mswcs100_ogc_cite	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,10 @@
+#! /bin/sh
+
+echo "[`date`] $REMOTE_ADDR - $SCRIPT_NAME?$QUERY_STRING" >> /tmp/mswcs100_ogc_cite.log
+
+MS_MAPFILE=/path/to/ms_ogc_cite/wcs-1.0.0/map/ms_ogc_cite_wcs100.map
+export MS_MAPFILE
+
+/path/to/www/cgi-bin/mapserv
+exit 0;
+


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/bin/mswcs100_ogc_cite
___________________________________________________________________
Added: svn:executable
   + *

Added: sandbox/ms_ogc_cite/wcs-1.0.0/data
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/data	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/data	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1 @@
+link ../wcs-data/data/
\ No newline at end of file


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/data
___________________________________________________________________
Added: svn:special
   + *

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/e.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/e.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/n.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/n.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/ne.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/ne.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/nw.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/nw.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.png
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/reference.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/s.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/s.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/se.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/se.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/sw.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/sw.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/w.gif
===================================================================
(Binary files differ)


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/map/graphics/w.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/ms_ogc_cite_wcs100.map
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/map/ms_ogc_cite_wcs100.map	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/map/ms_ogc_cite_wcs100.map	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,180 @@
+MAP
+  NAME 'demo'
+  EXTENT 159707.000000 4597395.000000 1400707.000000 5501395.000000
+  UNITS METERS
+  SIZE 500 400
+  SHAPEPATH '../data'
+
+  IMAGETYPE PNG
+
+
+  OUTPUTFORMAT
+    NAME GEOTIFF
+    DRIVER "GDAL/GTiff"
+    IMAGEMODE INT16
+    MIMETYPE "image/tiff"
+  END
+#  OUTPUTFORMAT
+#    NAME GEOTIFF_INT16
+#    DRIVER "GDAL/GTiff"
+#    IMAGEMODE INT16
+#    MIMETYPE "image/tiff"
+#  END
+  OUTPUTFORMAT
+    NAME GEOTIFF_RGB
+    DRIVER "GDAL/GTiff"
+    IMAGEMODE RGB
+    MIMETYPE "image/tiff"
+  END
+
+
+  WEB
+    TEMPLATE template.html
+    METADATA
+ 
+      "ows_schemas_location" "http://schemas.opengis.net/"
+
+      # OGC:WCS
+      "wcs_title" "CITE:OGC_CITE WCS Server"
+      "wcs_label" "UMN Test WCS Server"
+      "wcs_keywordlist" "WCS,MODIS,NDVI"
+      "wcs_description" "WCS Server to run OGC CITE Tests"
+      "wcs_onlineresource" "http://gw.mapgears.com:8500/cgi-bin/mswcs100_ogc_cite?"
+      "wcs_metadatalink_href" "http://gw.mapgears.com:8500/index.html"
+       "wcs_accesscontraints" "none"
+       "wcs_fees"              "none"
+       "wcs_updatesequence"   "1"
+     END
+    IMAGEURL "/tmp/"
+    IMAGEPATH "/tmp/ms_tmp/"
+  END
+
+  SCALEBAR
+    STATUS ON
+    UNITS MILES
+    SIZE 300 3
+    COLOR 0 0 0
+    OUTLINECOLOR 0 0 0
+    LABEL
+      SIZE SMALL
+      COLOR 0 0 0
+    END
+  END
+
+  REFERENCE
+    IMAGE graphics/reference.png
+    EXTENT 131106.000 4572787.000 1421825.000 5541248.000
+    SIZE 204 153
+    STATUS ON
+    COLOR -1 -1 -1
+    OUTLINECOLOR 180 0 0
+    MAXBOXSIZE 190
+  END
+
+  LAYER
+    NAME "ndvi_idx"
+    TYPE TILEINDEX
+    DATA "mod13"
+    FILTERITEM "imgdate"
+    FILTER "%time%"
+  END
+
+  LAYER
+    NAME "ndvi"
+    STATUS OFF
+    TYPE RASTER
+    PROCESSING "SCALE=AUTO"
+    METADATA
+      "wcs_label" "North Central US MODIS-based NDVI Images for 2002"
+      "ows_srs"	"EPSG:26915 EPSG:4269 EPSG:4326"
+      "ows_extent" "159707 4597895 1400207 5501395"
+      "wcs_resolution" "500.0 500.0"
+      "wcs_formats" "GeoTIFF"
+      "wcs_nativeformat" "raw binary"
+      "wcs_timePosition" "2002-01-01T14:11:14,2002-07-12T14:11:14"
+      "wcs_timeitem" "imgdate"
+      "wcs_rangeset_axes" "bands"
+      "wcs_rangeset_name" "ndvi Bands"
+      "wcs_rangeset_label" "Bands"
+      "wcs_rangeset_description" "Bands for ndvi"
+    END
+    DUMP TRUE
+    TILEINDEX 'ndvi_idx'
+    #Do not delete the projection block
+    PROJECTION 
+      "+init=epsg:26915"
+    END 
+  END
+
+  LAYER
+    NAME "fpar_idx"
+    TYPE TILEINDEX
+    DATA "mod13"
+    FILTERITEM "imgdate"
+    FILTER "%time%"
+  END
+
+  LAYER
+    NAME "fpar"
+    STATUS OFF
+    TYPE RASTER
+    PROCESSING "SCALE=AUTO"
+    METADATA
+      "wcs_label" "North Central US MODIS-based FPAR Images for 2002"
+      "ows_srs"   "EPSG:26915"
+      "ows_extent" "159707 4597895 1400207 5501395"
+      "wcs_resolution" "1000.0 1000.0"
+      "wcs_formats" "GeoTIFF"
+      "wcs_nativeformat" "raw binary"
+      "wcs_timePosition" "2002-01-01T14:10:13,2002-07-20T14:11:14"
+      "wcs_timeitem" "imgdate"
+      "wcs_rangeset_axes" "bands"
+      "wcs_rangeset_name" "fpar Bands"
+      "wcs_rangeset_label" "Bands"
+      "wcs_rangeset_description" "Bands for fpar"
+    END
+    DUMP TRUE
+    TILEINDEX "fpar_idx"
+    #Do not delete the projection block
+    PROJECTION 
+      "+init=epsg:26915"
+    END 
+
+  END
+
+  LAYER
+    NAME "modis_idx"
+    TYPE TILEINDEX
+    DATA "mod09"
+    FILTERITEM "imgdate"
+    FILTER "%time%"
+  END
+
+  LAYER
+    NAME "modis"
+    STATUS OFF
+    TYPE RASTER
+    PROCESSING "BANDS=4,3,2"
+    METADATA
+      "wcs_label" "North Central US MODIS Images for 2002"
+      "ows_extent" "159707 4597895 1400207 5501395"
+      "wcs_resolution" "500.0 500.0"
+      "ows_srs"   "EPSG:26915"
+      "wcs_formats" "GEOTIFF_RGB GEOTIFF_16BIT"
+      "wcs_nativeformat" "raw binary"
+      "wcs_bandcount" "7"
+      "wcs_timePosition" "2002-01-01T14:12:13,2002-07-20T14:11:14"
+      "wcs_timeitem" "imgdate"
+      "wcs_rangeset_axes" "bands"
+      "wcs_rangeset_name" "modis Bands"
+      "wcs_rangeset_label" "Bands"
+      "wcs_rangeset_description" "Bands for modis"
+    END
+    DUMP TRUE
+    TILEINDEX "modis_idx"
+    #Do not delete the projection block
+    PROJECTION 
+      "+init=epsg:26915"
+    END 
+  END
+END

Added: sandbox/ms_ogc_cite/wcs-1.0.0/map/template.html
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/map/template.html	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/map/template.html	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,207 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+  <head>
+    <title>WCS Demo Application - MapServer Template</title>
+
+<script language="JavaScript" src="[root]/javascript/general_utils.js"></script> 
+<script language="JavaScript" src="[root]/javascript/coverages.js"></script>
+<script language="JavaScript" src="[root]/javascript/cross-browser.com/x/x_load.js"></script>
+<script language="JavaScript">
+  var pansize = 0.80;
+  var xBands; // DHTML layer that holds the bands selection controls
+  
+  xInclude('[root]/javascript/cross-browser.com/x/x_core.js')
+
+  function WCS_download() {
+    var coverage = top.coverages_frame.lookup(GU_get_select(document.download.layer));
+    
+    var url = '[program]?map=[map]' +
+              '&SERVICE=WCS&VERSION=1.0.0&REQUEST=GetCoverage' +
+              '&COVERAGE=' + coverage.name +
+              '&TIME=' + GU_get_select(document.download.time) +
+              '&CRS=EPSG:26915' +
+              '&FORMAT=' + coverage.formats[0] +
+              '&RESX=' + coverage.resolution + '&RESY=' + coverage.resolution +
+              '&BBOX=' + document.download.imgext.value.split(' ').join(',');
+                            
+    if(coverage.bands.length > 0) // tag on bands parameter
+      url += '&bands=' + GU_get_select(document.download.red) + "," + GU_get_select(document.download.green) + "," + GU_get_select(document.download.blue);          
+              
+    window.open(url);
+  }
+
+  function pan(direction) {    
+    var x, y;
+
+    if(direction == 'n') {
+      x = ([mapwidth]-1)/2.0;
+      y = 0 - [mapheight]*pansize + [mapheight]/2.0;
+    } else if(direction == 'nw') {
+      x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
+      y = 0 - [mapheight]*pansize + [mapheight]/2.0;
+    } else if(direction == 'ne') {
+      x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
+      y = 0 - [mapheight]*pansize + [mapheight]/2.0;
+    } else if(direction == 's') {
+      x = ([mapwidth]-1)/2.0;
+      y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
+    } else if(direction == 'sw') {
+      x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
+      y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
+    } else if(direction == 'se') {
+      x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
+      y = ([mapheight]-1) + [mapheight]*pansize - [mapheight]/2.0;
+    } else if(direction == 'e') {
+      x = ([mapwidth]-1) + [mapwidth]*pansize - [mapwidth]/2.0;
+      y = ([mapheight]-1)/2.0;
+    } else if(direction == 'w') {
+      x = 0 - [mapwidth]*pansize + [mapwidth]/2.0;
+      y = ([mapheight]-1)/2.0;
+    }
+
+    document.download.zoom.options[3].selected = true; // force pan
+    document.download.imgxy.value = x + " " + y;
+    document.download.submit();
+  }
+  
+  function setBands() {
+    var coverage = top.coverages_frame.lookup(GU_get_select(document.download.layer));
+    
+    if(coverage.bands.length > 0) 
+      xShow(xBands);
+    else
+      xHide(xBands);
+      
+    // create the RGB select lists
+     for(var i=0; i<coverage.bands.length; i++) {
+      document.download.red.options[i] = new Option(coverage.bands[i], coverage.bands[i]); 
+      document.download.green.options[i] = new Option(coverage.bands[i], coverage.bands[i]);
+      document.download.blue.options[i] = new Option(coverage.bands[i], coverage.bands[i]);
+    }
+      
+    // restore previous settings
+    GU_set_select(document.download.red, '[red]');
+    GU_set_select(document.download.green, '[green]');
+    GU_set_select(document.download.blue, '[blue]');
+  }
+  
+  function setTimes() {
+    var coverage = top.coverages_frame.lookup(GU_get_select(document.download.layer));
+
+    // create the time select list
+    document.download.time.length = 0; // reset
+    for(var i=0; i<coverage.times.length; i++)
+      document.download.time.options[i] = new Option(coverage.times[i], coverage.times[i]); 
+
+    GU_set_select(document.download.time, '[time]'); // set the time select list
+  }
+
+  function doSubmit() {
+    var coverage = top.coverages_frame.lookup(GU_get_select(document.download.layer));
+    var element;
+  
+    // if necessary create a variable to pass to MapServer to control the displayed bands
+    if(coverage.bands.length > 0) {
+      var name = "map_" + coverage.name + "_processing";
+      var value = "BANDS=" + GU_get_select(document.download.red) + "," + GU_get_select(document.download.green) + "," + GU_get_select(document.download.blue);
+      GU_add_field(document.download, 'hidden', name, value);
+    }
+  
+    return true;
+  }
+
+  window.onload = function() {
+    // access the bands DHTML object 
+    xBands = xGetElementById('bands');
+  
+    // create the layer select list
+    document.download.layer.length = 0; // reset
+    for(var i=0; i<top.coverages_frame.coverages.length; i++) {
+      document.download.layer.options[i] = new Option(top.coverages_frame.coverages[i].label, top.coverages_frame.coverages[i].name);
+    }
+
+    GU_set_select(document.download.layer, '[layers]'); // set the layer select list
+
+    setTimes(); // set the time select list
+    setBands(); // set the RGB (bands) controls (if necessary);
+  }
+</script>
+  </head>
+
+  <body bgcolor="#ffffff">
+    <p><b>WCS Demo Application - MODIS Download</title></b></p>
+    
+    <form name="download" method="GET" action="[program]" onSubmit="return doSubmit()">
+
+    <input type="hidden" name="map" value="[map]">
+    <input type="hidden" name="imgext" value="[mapext]">
+    <input type="hidden" name="imgxy" value="[center]">
+    <input type="hidden" name="root" value="[root]">
+    <input type="hidden" name="program" value="[program]">
+
+    <table border=0 cellpadding=5>
+    <tr>
+
+    <td align="center" valign="top">
+      <table border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#666666">
+      <tr>
+        <td align="right" width="18"><a href="javascript:pan('nw')"><img src="[root]/graphics/nw.gif" width="18" height="18" border="0" alt="pan northwest"></a></td>
+        <td align="center"><a href="javascript:pan('n')"><img src="[root]/graphics/n.gif" width="23" height="18" border="0" alt="pan north"></a></td>
+        <td align="left" width="18"><a href="javascript:pan('ne')"><img src="[root]/graphics/ne.gif" width="18" height="18" border="0" alt="pan northeast"></a></td>
+      </tr>
+      <tr>
+        <td align="right" width="18"><a href="javascript:pan('w')"><img src="[root]/graphics/w.gif" width="18" height="23" border="0" alt="pan west"></a></td>
+        <td align="center"><INPUT type="image" name="img" src="[img]" width="[mapwidth]" height="[mapheight]" border="0" alt="this is the map"></td>
+        <td align="left" width="18"><a href="javascript:pan('e')"><img src="[root]/graphics/e.gif" width="18" height="23" border="0" alt="pan east"></a></td>
+      </tr>
+      <tr>
+        <td align="right" width="18"><a href="javascript:pan('sw')"><img src="[root]/graphics/sw.gif" width="18" height="18" border="0" alt="pan southwest"></a></td>
+        <td align="center"><a href="javascript:pan('s')"><img src="[root]/graphics/s.gif" width="23" height="18" border="0" alt="pan south"></a></td>
+        <td align="left" width="18"><a href="javascript:pan('se')"><img src="[root]/graphics/se.gif" width="18" height="18" border="0" alt="pan southeast"></a></td>
+      </tr>
+      </table>
+      <br>
+      <!-- [scale] --><img src="[scalebar]">
+    </td>
+    <td valign=top>
+      <p><b>Map Controls</b></p>
+      
+      <p>Select the coverage to display:<br>
+      <select name="layer" size="1" onChange="setTimes();setBands();">
+        <option> This will the set of available layers
+      </select></p>
+
+      <p id="bands" style="position:relative; visibility:hidden;">Select the bands to use for coverage display:<br>
+      <table><tr>
+        <td>r: <select name="red" size="1"><option> red</select></td>
+        <td>g: <select name="green" size="1"><option> green</select></td>
+        <td>b: <select name="blue" size="1"><option> blue</select></td>
+      </tr></table></p>
+
+      <p id="times">Select the coverage date to display:<br>
+      <select name="time" size="1">
+        <option> This will the set of available time periods for a specific layer
+      </select></p>
+
+      <p>Select your zoom option:<br>
+      <select name="zoom" size="1">
+        <option value="4" [zoom_4_select]> Zoom in 4 times
+        <option value="3" [zoom_3_select]> Zoom in 3 times
+        <option value="2" [zoom_2_select]> Zoom in 2 times
+        <option value="1"  [zoom_1_select]> Recenter Map
+        <option value="-2" [zoom_-2_select]> Zoom out 2 times
+        <option value="-3" [zoom_-3_select]> Zoom out 3 times
+        <option value="-4" [zoom_-4_select]> Zoom out 4 times
+      </select></p>
+
+      <p><input type="submit" value="Go">
+      <input type="button" value="Download" onClick="WCS_download()"></p>
+
+      <input type="image" name="ref" src="[ref]">
+
+    </td>
+    </tr></table>
+
+    </form>
+  </body>
+</html>
\ No newline at end of file

Added: sandbox/ms_ogc_cite/wcs-1.0.0/perl/common.pl
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/perl/common.pl	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/perl/common.pl	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,68 @@
+#!/usr/bin/perl
+
+use XBase;
+
+$scratch = '/tmp/';
+
+$shpstore = '/net/lobo/lobo04/samba_ac/shapelib/';
+$web_shpstore = '/usr/local/www/data/shapefiles/';
+
+$sortshp = '/export/stlime/mapserv/bin/sortshp';
+$shptree = '/export/stlime/mapserv/bin/shptree';
+
+ at extensions = ('.dbf', '.idx', '.qix', '.shp', '.shx');
+
+sub build_spatial_index() {
+  my($file, $depth) = @_;
+
+  die 'No source file supplied.' unless $file;
+  die 'Quadtree depth must be greater than zero.' unless $depth > 0;
+
+  system("$shptree $file $depth");
+}
+
+sub clean() {
+  my($base) = @_;
+
+  foreach (@extensions) {
+    system("rm $base".$_);
+  }
+}
+
+sub copy() {
+  my($from_base, $to_base) = @_;
+
+  die 'No source file supplied.' unless $from_base;
+  die 'No destination file supplied.' unless $to_base;
+
+  foreach (@extensions) {
+    system("cp $from_base".$_." $to_base".$_);
+  }
+}
+
+sub additem() {
+  my($table_name, $field_name, $field_type, $field_length, $field_decimals, $initial_value) = @_;
+
+  my $temp_table_name = $scratch.'temporary.dbf';
+  system("mv $table_name $temp_table_name");
+
+  my $oldtable = new XBase $temp_table_name or die XBase->errstr;
+
+  my $newtable = XBase->create("name" => $table_name,
+			       "field_names" => [$oldtable->field_names, $field_name],
+			       "field_types" => [$oldtable->field_types, $field_type],
+			       "field_lengths" => [$oldtable->field_lengths, $field_length],
+			       "field_decimals" => [$oldtable->field_decimals, $field_decimal],
+			       );
+
+  foreach (0 .. $oldtable->last_record) {
+    ($deleted, @data) = $oldtable->get_record($_);
+    push @data, $initial_value;
+    $newtable->set_record($_, @data);
+  }
+
+  $newtable->close();
+  $oldtable->close();
+
+  unlink($temp_table_name);
+}

Added: sandbox/ms_ogc_cite/wcs-1.0.0/perl/extractdate.pl
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/perl/extractdate.pl	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/perl/extractdate.pl	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,44 @@
+#!/usr/bin/perl
+
+use XBase;
+
+opendir(DIR, '.');
+foreach $file (readdir(DIR)) {
+    next if !($file =~ /\.dbf$/);
+
+    print "Working on $file...\n";
+
+    $tfile = 'temporary.dbf';
+    system("mv $file $tfile");
+
+    $oldtable = new XBase $tfile or die XBase->errstr;
+
+    print join("\t", $oldtable->field_names) ."\n";
+    print join("\t", $oldtable->field_types) ."\n";
+    print join("\t", $oldtable->field_lengths) ."\n";
+    print join("\t", $oldtable->field_decimals) ."\n";
+
+    $newtable = XBase->create("name" => $file, 
+			      "field_names" => [$oldtable->field_names, "IMGDATE"], 
+			      "field_types" => [$oldtable->field_types, "C"], 
+			      "field_lengths" => [$oldtable->field_lengths, 8], 
+			      "field_decimals" => [$oldtable->field_decimals, undef]) or die "Error creating new table.";
+
+    foreach (0 .. $oldtable->last_record) {
+	($deleted, @data) = $oldtable->get_record($_);
+  
+	print "  ...record $data[0]\n";
+
+        # extract the date
+        $year = substr $data[0], 7, 4;
+	$day = substr $data[0], 11, 3;
+
+	push @data, "$year-$day";
+	$newtable->set_record($_, @data);
+    }
+
+    $newtable->close();
+    $oldtable->close();
+
+    unlink($tfile);
+}


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/perl/extractdate.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: sandbox/ms_ogc_cite/wcs-1.0.0/perl/mkhdr.pl
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/perl/mkhdr.pl	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/perl/mkhdr.pl	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,66 @@
+#!/usr/bin/perl
+
+opendir(DIR, '.');
+foreach $file (readdir(DIR)) {
+    next if !($file =~ /\.old$/);
+    $newfile = $file;
+    $newfile =~ s/\.old//;
+
+    open INFILE, $file or die "Error opening $file.";
+    open OUTFILE, '>'.$newfile or die "Error opening $newfile.";
+
+    while(<INFILE>) {
+        chop;
+
+	if(/^lines/) {
+	    ($keyword, $lines) = split ', ', $_;
+	} elsif(/^pixels/) {
+	    ($keyword, $pixels) = split ', ', $_;
+        } elsif(/^datatype/) {	    
+	    $datatype = 2; # for single band images
+            $datatype = 1 if $file =~ /^MOD09/; # 7 band images
+	} elsif(/^interleaving/) {
+	    ($keyword, $interleaving) = split ', ', $_;
+        } elsif(/^bands/) {
+	    ($keyword, $bands) = split ', ', $_; # this is likely wrong in the file
+	    $bands = 1;
+	    $bands = 7 if $file =~ /^MOD09/;
+	} elsif(/^ulx/) {
+	    ($keyword, $ulx) = split ', ', $_;           
+        } elsif(/^uly/) {
+	    ($keyword, $uly) = split ', ', $_;           
+        } elsif(/^lrx/) {
+	    ($keyword, $lrx) = split ', ', $_;           
+        } elsif(/^lry/) {
+	    ($keyword, $lry) = split ', ', $_;           
+        } elsif(/^pwidth/) {
+	    ($keyword, $pwidth) = split ', ', $_;           
+        } elsif(/^pheight/) {
+	    ($keyword, $pheight) = split ', ', $_;           
+        } elsif(/^units/) {
+	    ($keyword, $units) = split ', ', $_;           
+        } elsif(/^proj/) {
+	    ($keyword, $proj) = split ', ', $_;           
+        } 
+    }
+
+    print "$file $bands $pixels $lines\n";
+
+    print OUTFILE "ENVI\n";
+    print OUTFILE "description = {$file}\n";
+    print OUTFILE "samples = $pixels\n";
+    print OUTFILE "lines = $lines\n";
+    print OUTFILE "bands = $bands\n";
+    print OUTFILE "data type = $datatype\n";
+    print OUTFILE "header offset = 0\n";
+    print OUTFILE "file type = ENVI Standard\n";
+    print OUTFILE "interleave = bip\n";
+    print OUTFILE "sensor type = MODIS\n";
+    print OUTFILE "byte order = 0\n";
+    print OUTFILE "x start = 0\n";
+    print OUTFILE "y start = 0\n";
+    print OUTFILE "map info = {UTM, 1.0, 1.0, $ulx, $uly, $pwidth, $pheight, 15, North, units=Meters}\n";
+
+    close INFILE;
+    close OUTFILE;
+}


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/perl/mkhdr.pl
___________________________________________________________________
Added: svn:executable
   + *

Added: sandbox/ms_ogc_cite/wcs-1.0.0/perl/rename.pl
===================================================================
--- sandbox/ms_ogc_cite/wcs-1.0.0/perl/rename.pl	                        (rev 0)
+++ sandbox/ms_ogc_cite/wcs-1.0.0/perl/rename.pl	2010-03-22 17:51:02 UTC (rev 9974)
@@ -0,0 +1,9 @@
+#!/usr/bin/perl
+
+opendir(DIR, '.');
+foreach $file (readdir(DIR)) {
+    next if !($file =~ /\.img$/);
+    $newfile = $file;
+    $newfile =~ s/img/bin/;
+    system "mv $file $newfile";
+}


Property changes on: sandbox/ms_ogc_cite/wcs-1.0.0/perl/rename.pl
___________________________________________________________________
Added: svn:executable
   + *



More information about the mapserver-commits mailing list