Project

General

Profile

« Previous | Next » 

Revision 3039

Added by perry about 18 years ago

Removed old spatial classes

View differences:

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

  
25
public class MetacatSpatialConstants {
26

  
27
  public static final float FLOAT_NULL = (float)1e20;
28

  
29
  /** like: nebulous.msi.ucsb.edu:9999 **/
30
  public static String servercontext;
31

  
32
  // default to off -- get from the metacat properties file 
33
  public static boolean runSpatialOption = false;
34

  
35
  //metacat?action=read&docid=knb2003.432.1&qformat=knb
36
  public static String metacatcontext = "knp";
37
  
38
  public static  void setServerContext(String _scontext) {
39
    servercontext = _scontext;
40
  }
41

  
42
  public static String getServerContext() { return servercontext; }
43

  
44
  public static String getMetacatContext() { return metacatcontext;}
45
  
46

  
47
}
48 0

  
src/edu/ucsb/nceas/metacat/spatial/PersistentMetacatSpatialDataset.java
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$'
8
 * '$Revision$'
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
 * usage: metacat2shape metacat_export.txt test.shp
45
 *
46
 *   where:
47
 *
48
 *       input -- is an input ASCII file, that contains the following cols:
49
 *             -> docid -- the document id
50
 *             -> x -- the xlocation
51
 *             -> y -- the y location
52
 *             -> url -- the url to the document
53
 *                shapefile -- {output} is a ESRI shapefile
54
 *
55
 *             see:
56
 *             example: metacat2shape metacat_export.txt test.shp
57
 *
58
 *             ##><><><><><><><><><><><><><><><><><><><><><><><><>##
59
 *             ##           John Harris                           ##
60
 *             ##           harris@nceas.ucsb.edu                 ##
61
 *             ##           Copyright 1999-2003                   ##
62
 *             ##><><><><><><><><><><><><><><><><><><><><><><><><>##
63
 *                                                                       
64
 */
65
public class PersistentMetacatSpatialDataset {
66
  
67
  private String textQueryAsciiFile = "/tmp/mso_metacat_textquery.ascii";
68
  private String metacatTextQueryShapeFile = "/tmp/mso_metacat_textquery.shp";
69
  private String metacatSpatialCacheAsciiFile = "/tmp/mso_metacat_cache.ascii";
70
  private String metacatSpatialCacheShapeFile = "/tmp/mso_metacat_cache.shp";
71
  
72
  private static Logger log = Logger.getLogger(PersistentMetacatSpatialDataset.class.getName());
73
  
74
  
75
  /*
76
   * Writes the dataset to the file system
77
   */
78
  public void writeMetacatSpatialCache(MetacatSpatialDataset dataset) {
79
  try {
80
    PrintStream out = new PrintStream(new FileOutputStream( metacatSpatialCacheAsciiFile));
81
    
82
    out.println("#HEADER docid x y  url");
83

  
84
    out.println( dataset.getExtentsDataAsAscii());
85
    log.fatal("extents data: " + dataset.getExtentsDataAsAscii() +" done" );
86

  
87
    out.close();
88

  
89

  
90
    // make the shapefile 
91
     String command = "metacat_shapefile "+metacatSpatialCacheAsciiFile+" "+metacatSpatialCacheShapeFile;
92
     try{
93
      Process p = Runtime.getRuntime().exec(command);
94
     }
95
     catch(IOException ioe){
96
         log.error("ERROR - writing the shapefile at: " + 
97
                 metacatSpatialCacheAsciiFile+" "+metacatSpatialCacheShapeFile);
98
         ioe.printStackTrace(); 
99
     }
100

  
101
  } catch (FileNotFoundException fnfe) {
102
    log.fatal("ERROR: could not find the file ");
103
    fnfe.printStackTrace();
104
  }  
105
  
106
  
107
  }
108

  
109

  
110
  
111
  /*
112
   * Writes the dataset to the file system
113
   */
114
  public void writeTextQueryData(MetacatSpatialDataset dataset) {
115
 
116
  try {
117
    PrintStream out = new PrintStream(new FileOutputStream(textQueryAsciiFile));
118
    
119
    out.println("#HEADER x y z segid");
120

  
121
    out.println( dataset.getExtentsDataAsAscii());
122
    
123
    out.close();
124
    
125
    // make the shapefile 
126
     String command = "metacat_shapefile "+textQueryAsciiFile+" "+metacatTextQueryShapeFile;
127
     try{
128
      Process p = Runtime.getRuntime().exec(command);
129
     }
130
     catch(IOException ioe){
131
         log.error("ERROR - writing the shapefile at: " + 
132
                 metacatSpatialCacheAsciiFile+" "+metacatSpatialCacheShapeFile);
133
         ioe.printStackTrace();
134
     }
135

  
136
    
137
  } catch (FileNotFoundException fnfe) {
138
    log.fatal("ERROR: could not find the file ");
139
    fnfe.printStackTrace();
140
  }  
141
  
142

  
143
  }
144

  
145
}
146 0

  
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialDocument.java
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$'
8
 * '$Revision$'
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
package edu.ucsb.nceas.metacat.spatial;
26

  
27
import org.apache.log4j.Logger;
28

  
29
/**
30
 * Class that reflects a Metacat Document in a spatially represented sense.
31
 */
32
public class MetacatSpatialDocument {
33

  
34
  private static Logger log = Logger.getLogger(MetacatSpatialDocument.class.getName());
35
  
36
  private String docid;
37

  
38
  private String title;
39

  
40
  private MetacatSpatialExtents extents;
41

  
42
  public MetacatSpatialDocument(String  docid) {
43
    setDocid(docid);
44
  }
45

  
46
  
47

  
48
  /**
49
   * function that registers the document with the Spatial system.  This is 
50
   * to be called when the document is inserted to the Metacat system.  At
51
   * registration time, this the Metacat Spatial Elements are requeruried, 
52
   * and the spatial database is repopulated
53
   */
54
  public void registerSpatialDocument() {
55
   log.info("Dataset " + docid + " is being registered with the metacat spatial system" ); 
56
  }
57

  
58
  public void setDocid(String _docid) {
59
    this.docid = _docid;
60
  }
61

  
62
  public void setExtents(MetacatSpatialExtents _extents) {
63
    this.extents = _extents;
64
  }
65

  
66

  
67
  /**
68
   * jitters a float value
69
   */
70
  public float jitter(float _val) {
71
    float _random = (float)Math.random();
72
    return _val+(_random/1000);
73
  }
74

  
75
  public String getMetacatURL() {
76
  
77
   return MetacatSpatialConstants.getServerContext()
78
   +"/"+MetacatSpatialConstants.getMetacatContext()+"/"; 
79
  
80
  }
81

  
82
  public String getTitle() { return this.title; }
83
  public void setTitle(String _title) {this.title = _title; }
84

  
85
  public float getXMin() { return extents.getXMin(); }
86
  public void setXMin(float x) { extents.setXMin(x); }
87
  
88
  public float getYMin() { return extents.getYMin(); }
89
  public void setYMin(float y) {extents.setYMin(y); }
90
  
91
  public float getXMax() { return extents.getXMax(); }
92
  public void setXMax(float x) {extents.setXMax(x); }
93
  
94
  public float getYMax() { return extents.getYMax(); }
95
  public void setYMax(float y) {extents.setYMax(y); }
96
  
97
  public String getDocid() { return this.docid; }
98
  
99
  public boolean getIsPoint() { return extents.getIsPoint(); }
100
  public void setIsPoint(boolean ispoint) { extents.setIsPoint(ispoint); }
101

  
102
}
103 0

  
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialExtents.java
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$'
8
 * '$Revision$'
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 org.apache.log4j.Logger;
29

  
30
/**
31
 * Class that reflects a query against Metacat to gatther spatial data  -- this
32
 * could be a text query that returns a spatial dataset or a spatial query that
33
 * returns a spatially-referenced dataset.
34
 */
35
public class MetacatSpatialExtents {
36
  
37
  /** true if the document is represented by a single point and 
38
   *  false if is represented by a bouding box
39
   */
40
  private boolean isPoint = true;
41

  
42
  /** the coordinates of the bounding box, or of the point **/
43
  private float xmin, ymin, xmax, ymax; 
44

  
45
  /** the docid of the extents **/
46
  private String docid;
47
 
48
  private static Logger log = Logger.getLogger(MetacatSpatialExtents.class.getName());
49

  
50
  public MetacatSpatialExtents() {}
51
  
52
  public MetacatSpatialExtents(String _docid ) {
53
    setDocid(_docid);
54
  }
55

  
56
  public void setIsPoint(boolean valid) {
57
    this.isPoint = valid;
58
  }
59

  
60
  public boolean getIsPoint() {
61
    return this.isPoint;
62
  }
63

  
64
  public void setDocid(String _docid) {
65
    this.docid = _docid;
66
  }
67

  
68
  public String getDocid() {
69
    return docid;
70
  }
71

  
72
  public void setXMin(float _xmin) {
73
    this.xmin = _xmin;
74
  }
75

  
76
  public float getXMin() { return xmin; }
77
  
78
  public void setYMin(float _ymin) {
79
    this.ymin = _ymin;
80
  }
81
  
82
  public float getYMin() { return ymin; }
83
  
84
  public void setXMax(float _xmax) {
85
    this.xmax = _xmax;
86
  }
87
  
88
  public float getXMax() { return xmax; }
89
  
90
  public void setYMax(float _ymax) {
91
    this.ymax = _ymax;
92
  }
93
  
94
  public float getYMax() { return ymax; }
95

  
96
  public String toString() {
97
   return ("\n\n***************************************************************"
98
          +"\n docid: " +  docid + " \n is point: " + isPoint
99
          +"\n x min: " +  getXMin() + " \n x max: " + getXMax() 
100
          +"\n y min: " +  getYMin() + " \n y max: " + getYMax()
101
          +"\n***************************************************************\n"); 
102
  
103
  }
104

  
105

  
106
}
107 0

  
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialQuery.java
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$'
8
 * '$Revision$'
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 org.apache.log4j.Logger;
29

  
30
/**
31
 * Class that reflects a query against Metacat to gather spatial data  -- this
32
 * could be a text query that returns a spatial dataset or a spatial query that
33
 * returns a spatially-referenced dataset.
34
 */
35
public class MetacatSpatialQuery {
36
  
37
  private static Logger log = Logger.getLogger(MetacatSpatialQuery.class.getName());
38

  
39
  private MetacatSpatialDocument msd;
40

  
41
  private SpatialQueryProcessor mqp;
42

  
43
  public MetacatSpatialQuery() { }
44

  
45
  /// query that returns a dataset constarined by a bounding box
46
  public MetacatSpatialDataset queryDatasetByCartesianBounds(float _xmin,
47
                                                             float _ymin, 
48
                                                             float _xmax, 
49
                                                             float _ymax) {
50
  
51
 
52
    /** all database querying is carried out in the Query Processor */
53
    mqp = new  SpatialQueryProcessor();
54
    
55
    // return the proc's results
56
    return mqp.queryDatasetByCartesianBounds(_xmin, _ymin, _xmax, _ymax);
57
 
58
  }
59

  
60

  
61
  /**
62
   * returns the metacat spatial document retrieved by this query
63
   */
64
  public MetacatSpatialDocument getSpatialDocument(String docid) {
65
    msd = new MetacatSpatialDocument(docid);
66
    
67
    log.info("creating spatial reference for docid: " + docid);
68
    
69
    /** all database querying is carried out in the Query Processor */
70
    mqp = new  SpatialQueryProcessor();
71
    
72
    // this call will return the extents (a class) of the docid
73
    MetacatSpatialExtents _extents = mqp.queryExtentsByDocid(docid);
74

  
75
    //set the elements on the spatialdocument
76
    msd.setDocid(docid);
77
    msd.setExtents(_extents);
78

  
79
    // destroy the processor
80
    mqp.close();
81
   
82
   return msd; 
83
  }
84

  
85
}
86 0

  
src/edu/ucsb/nceas/metacat/spatial/QueryFailedException.java
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$'
8
 * '$Revision$'
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
package edu.ucsb.nceas.metacat.spatial;
26

  
27
import org.apache.log4j.Logger;
28

  
29
/**
30
 * Exception thrown when an error occurs trying to query for the
31
 * list of meeting document
32
 */
33
public class QueryFailedException extends Exception {
34
  
35

  
36
    /**
37
     * Create a new QueryFailedException.
38
     *
39
     * @param message The error or warning message.
40
     */
41
    public QueryFailedException(String message) {
42
      super(message);
43
    }
44
}
45 0

  
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialDataset.java
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$'
8
 * '$Revision$'
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
package edu.ucsb.nceas.metacat.spatial;
26

  
27
import java.util.Vector;
28

  
29
import org.apache.log4j.Logger;
30

  
31
/**
32
 * Class that reflects a dataset of Metacat Documents in a spatially represented
33
 * sense.  This dataset class is comprised of multiple MetacatSpatialDocument 
34
 * and uses the PersistentMetacatSpatialDataset class for IO with databases
35
 * and the file system
36
 */
37
public class MetacatSpatialDataset {
38
 
39
  private boolean initialized = false;
40

  
41
  private static Logger log = Logger.getLogger(MetacatSpatialDataset.class.getName());
42
 
43
  private Vector docs; // vector of MetacatSpatialDocument's 
44
  
45
 
46
  /** empty constructor **/
47
  public MetacatSpatialDataset() {
48
    this.initialized = true;
49
    docs = new Vector();
50
  }
51
 
52

  
53
  /**
54
    * returns a string array of the docids 
55
    */
56
  public String[] getDocidList() {
57
    String[] s = new String[docs.size()];
58
    for (int i = 0; i < docs.size(); i++) {
59
        MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
60
        s[i] = _doc.getDocid();
61
    }
62
    return s;
63
  }
64
  
65
  /**
66
   * Returns docid's in a csv-formatted text string
67
   */
68
   public String toTXT () {
69
    StringBuffer _sb = new StringBuffer();
70
    for (int i = 0; i < docs.size(); i++) {
71
      MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
72
      if ( i==0 ) {
73
        _sb.append(_doc.getDocid());
74
      } else { 
75
        _sb.append(","+_doc.getDocid());
76
     }
77
    } 
78
    return _sb.toString();
79
   }
80

  
81
  /**
82
   * Returns XML as a String -- the xml describes the dataset
83
   */
84
   public String toXML () {
85
    StringBuffer _sb = new StringBuffer();
86

  
87
    _sb.append("<metacatspatialdataset>");
88
    for (int i = 0; i < docs.size(); i++) {
89
      
90
      MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
91
      
92
      _sb.append("<metacatspatialdocument>\n");
93
    
94
     _sb.append("<creator>");
95
     _sb.append(" <individualName>");
96
     _sb.append("   <givenName></givenName>");
97
     _sb.append("   <surName></surName>");
98
     _sb.append(" </individualName>");
99
     _sb.append(" <organizationName></organizationName>");
100
     _sb.append(" </creator>");
101

  
102
     _sb.append("<title>"+_doc.getTitle()+"</title>");
103
     _sb.append("<docid>"+_doc.getDocid()+"</docid>");
104
     _sb.append(" <extents>");
105
     _sb.append("   <ispoint>"+_doc.getIsPoint()+"</ispoint>");
106
     _sb.append("   <xmin>"+_doc.getXMin()+"</xmin>");
107
     _sb.append("   <ymin>"+_doc.getYMin()+"</ymin>");
108
     _sb.append("   <xmax>"+_doc.getXMax()+"</xmax>");
109
     _sb.append("   <ymax>"+_doc.getYMax()+"</ymax>");
110
     _sb.append(" </extents>\n");
111

  
112
     
113
      _sb.append("</metacatspatialdocument>");
114

  
115
    } 
116
    _sb.append("</metacatspatialdataset>");
117
  
118
    return _sb.toString();
119
   }
120

  
121

  
122
  /**
123
   * returns the document corresponding to the input index from this dataset
124
   */
125
  public MetacatSpatialDocument getDocument(int _id) {
126
    return (MetacatSpatialDocument)docs.elementAt(_id);
127
  }
128

  
129
  /*
130
   * Adds a new MetacatSpatialDocument to this dataset
131
   */
132
   public void add(MetacatSpatialDocument msdoc) {
133
    docs.add(msdoc);
134
   }
135

  
136

  
137
   /**
138
    * Returns the size (or number of documents) of the dataset
139
    */
140
    public int size() {
141
      return docs.size();
142
    }
143

  
144

  
145
  /**
146
   * returns the data set as a flat-ascii table like:
147
   *
148
   * x y z segid 
149
   *
150
   * the data are delimited by spaces and each line is terminated bt '\n'
151
   * out.println("#HEADER docid x y  url");
152
   */
153
  public StringBuffer getExtentsDataAsAscii() {
154
    StringBuffer _sb = new StringBuffer();
155
    for (int i = 0; i < docs.size(); i++) {
156
      MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
157
      try {
158
      if ( ! _doc.getIsPoint() ) {
159
        //_sb.append( _doc.getDocid()+" "+ _doc.getXMin()+ " " + _doc.getYMin() + " http://www.cnn.com \n");
160
        //_sb.append( _doc.getDocid()+" "+ _doc.getXMax()+ " " + _doc.getYMin() + " http://www.cnn.com \n");
161
        _sb.append( _doc.getDocid()+" "+ _doc.jitter(_doc.getXMax())+ " " 
162
          + _doc.jitter(_doc.getYMax()) + " " 
163
          + "http://"+_doc.getMetacatURL() + "metacat?action=read&docid="+_doc.getDocid()+"&qformat=knp"
164
          + " \n");
165
        //_sb.append( _doc.getDocid()+" "+ _doc.getXMin()+ " " + _doc.getYMax() + " http://www.cnn.com \n");
166
      }
167
      } catch (NullPointerException npe) {
168
        log.fatal("ERROR: null pointer exception on a spatial document");
169
        npe.getMessage();
170
      }
171
    }
172
    return _sb;
173
  }
174

  
175
  /**
176
   * writes the entire metacat spatial dataset 
177
   */
178
   public void writeMetacatSpatialCache() {
179
    // write the data stored in this object using the persistent layer
180
    PersistentMetacatSpatialDataset _writer = new PersistentMetacatSpatialDataset();
181
     _writer.writeMetacatSpatialCache(this);  
182
   }
183

  
184

  
185
  /*
186
   * Writes the dataset to the file system
187
   */
188
  public void writeTextQueryData() { 
189
    // write the data stored in this object using the persistent layer
190
    PersistentMetacatSpatialDataset _writer = new PersistentMetacatSpatialDataset();
191
     _writer.writeTextQueryData(this); 
192
  }
193

  
194

  
195

  
196
  
197
  
198

  
199
}
200 0

  
src/edu/ucsb/nceas/metacat/spatial/SpatialHarvester.java
140 140
   */
141 141
  public void harvestDocument( String docid ) {
142 142

  
143
     long before = System.currentTimeMillis();
143 144
     // Read the existing spatial dataset cache
144 145
     SpatialDataset sds = new SpatialDataset();
145 146

  
......
153 154

  
154 155
         Feature pointFeature = sdoc.getPointFeature();
155 156
         sds.insertOrUpdate("point", pointFeature, docid );
156
         log.info(" --------- Spatial Harvester - spatial cache updated for : " + docid );
157
         long after = System.currentTimeMillis();
158
         log.info(" ------- Spatial Harvester - spatial cache updated for : " + docid + ".... Time  " + (after - before) + "ms");
157 159
     } catch (IOException e) {
158 160
         log.error("IOException while performing spatial harvest ");
159 161
     }
src/edu/ucsb/nceas/metacat/spatial/SpatialDataset.java
164 164
    ShapefileDataStore dStore = null;
165 165

  
166 166
    // Explain why geotools fails to create the projection info from the shapefile
167
    log.info( " The '.prj' errors below are related to a geotools bug " +
168
              " (http://jira.codehaus.org/browse/GEOT-604) and can be ignored");
167
    //log.info( " The '.prj' errors below are related to a geotools bug " +
168
    //          " (http://jira.codehaus.org/browse/GEOT-604) and can be ignored");
169 169

  
170 170
    try {
171 171
        // Create the filter

Also available in: Unified diff