Project

General

Profile

1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2000 Regents of the University of California and the
4
 *             National Center for Ecological Analysis and Synthesis
5
 *
6
 * Author: John Harris 
7
 * '$Date: 2006-02-16 13:41:30 -0800 (Thu, 16 Feb 2006) $'
8
 * '$Revision: 2909 $'
9
 *
10
 * This program is free software; you can redistribute it and/or modify
11
 * it under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation; either version 2 of the License, or
13
 * (at your option) any later version.
14
 *
15
 * This program is distributed in the hope that it will be useful,
16
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18
 * GNU General Public License for more details.
19
 *
20
 * You should have received a copy of the GNU General Public License
21
 * along with this program; if not, write to the Free Software
22
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
23
 */
24

    
25

    
26
package edu.ucsb.nceas.metacat.spatial;
27

    
28
import java.io.BufferedReader;
29
import java.io.FileReader;
30
import java.io.PrintStream;
31
import java.io.OutputStream;
32
import java.io.FileOutputStream;
33
import java.io.IOException;
34
import java.io.FileNotFoundException;
35

    
36

    
37
import org.apache.log4j.Logger;
38

    
39
/**
40
 * Class for doing IO of spatial data from.  IO can be with the FS in the 
41
 * case of a shapefile, and or with a DB (as in the case of a PostGIS 
42
 * entry or a Metacat Entry)
43
 */
44
public class PersistentMetacatSpatialDataset {
45
  
46
  private String textQueryAsciiFile = "/tmp/mso_metacat_textquery.ascii";
47
  
48
  private static Logger log = Logger.getLogger(PersistentMetacatSpatialDataset.class.getName());
49
  
50

    
51
  
52
  /*
53
   * Writes the dataset to the file system
54
   */
55
  public void writeTextQueryData(MetacatSpatialDataset dataset) {
56
 
57
  try {
58
    PrintStream out = new PrintStream(new FileOutputStream(textQueryAsciiFile));
59
    
60
    out.println("#HEADER x y z segid");
61

    
62
    out.println( dataset.getExtentsDataAsAscii());
63

    
64
    out.close();
65

    
66
  } catch (FileNotFoundException fnfe) {
67
    log.fatal("ERROR: could not find the file ");
68
    fnfe.printStackTrace();
69
  }  
70
  
71

    
72
  }
73

    
74
}
(6-6/10)