Project

General

Profile

« Previous | Next » 

Revision 2915

Added by harris over 18 years ago

Integration of new shapefile writers (r. reeves code) with MSO.

View differences:

src/spatial/cpp/metacat_shapefile.cpp
56 56
 *
57 57
 * @param the number of lines in the coordinates arrays
58 58
 ************************************************************************/
59
static void WritePointsArray(int nSHPType,
60
                             const char *pszFilename,
61
                             float min_pntx[40000][100],
62
                             float max_pntx[40000][100],
63
                             float min_pnty[40000][100],
64
                             float max_pnty[40000][100],
65
                             float pointz[40000][100],
66
                             vector < string > urlvec,
67
                             vector < string > docidvec,
68
                             int number_data_lines)
69
{
59
// 
60
// 2/19/06 R Reeves modified array declarations for WritePointsArray funciton.
61
//
62
const int number_data_lines = 100;
63
static void WritePointsArray ( int nSHPType,
64
                               const char * pszFilename,
65
                               float min_pntx[][100],
66
                               float max_pntx[][100],
67
                               float min_pnty[][100],
68
                               float max_pnty[][100],
69
                               float pointz[][100],
70
                               vector<string> urlvec,
71
                               vector<string> docidvec,
72
                               int number_data_lines_x
73
							  )
74
{  
75
       SHPHandle hSHPHandle;
76
       SHPObject * psShape;
77
       double x, y, z, m, j, dx[number_data_lines], dy[number_data_lines], dz[number_data_lines];
78
       int ii, iRecord, i;
79
       char buf[20];
80
       char intString;
81
       //for the dbf file
82
       DBFHandle hDBF;
70 83

  
71
  SHPHandle hSHPHandle;
72
  SHPObject *psShape;
73
  double x, y, z, m, j, dx[number_data_lines], dy[number_data_lines],
74
      dz[number_data_lines];
75
  int ii, iRecord, i;
76
  char buf[20];
77
  char intString;
78
  //for the dbf file
79
  DBFHandle hDBF;
84
       //create the dbf file
85
       hDBF = DBFCreate( pszFilename );
86
       if ( hDBF == NULL )
87
       {
88
         printf( "DBFCreate(%s) failed.\n" );
89
         exit( 2 );
90
       }
80 91

  
81
  //create the dbf file
82
  hDBF = DBFCreate(pszFilename);
83
  if (hDBF == NULL) {
84
    printf("DBFCreate(%s) failed.\n");
85
    exit(2);
86
  }
87
  //add to the dbf file attributes for ID, pval(elevation), url
88
  if (DBFAddField(hDBF, "ID", FTInteger, 10, 0) == -1) {
89
    printf("DBFAddField(%s,FTInteger,%d,0) failed.\n");
90
  }
91
  if (DBFAddField(hDBF, "area_coef", FTDouble, 10, 4) == -1) {
92
    printf("DBFAddField(%s,FTDouble,%d,0) failed.\n");
93
  }
94
  if (DBFAddField(hDBF, "url", FTString, 220, 0) == -1) {
95
    printf("DBFAddField(%s,FTString,%d,0) failed.\n");
96
  }
97
  if (DBFAddField(hDBF, "docid", FTString, 220, 0) == -1) {
98
    printf("DBFAddField(%s,FTString,%d,0) failed.\n");
99
  }
92
       //add to the dbf file attributes for ID, pval(elevation), url
93
       if ( DBFAddField( hDBF, "ID", FTInteger, 10, 0 ) == -1 )
94
       {
95
         printf( "DBFAddField(%s,FTInteger,%d,0) failed.\n" );
96
       }
97
       if ( DBFAddField( hDBF, "area_coef", FTDouble, 10, 4 ) == -1 )
98
       {
99
         printf( "DBFAddField(%s,FTDouble,%d,0) failed.\n" );
100
       }
101
       if ( DBFAddField( hDBF, "url", FTString, 220, 0 ) == -1 )
102
       {
103
         printf( "DBFAddField(%s,FTString,%d,0) failed.\n" );
104
       }
105
       if ( DBFAddField( hDBF, "docid", FTString, 220, 0 ) == -1 )
106
       {
107
         printf( "DBFAddField(%s,FTString,%d,0) failed.\n" );
108
       }
100 109

  
101
  //cout<<" DBF Record Count --> "<<iRecord<<endl;
102
  int id_field = DBFGetFieldIndex(hDBF, "ID");
103
  int url_field = DBFGetFieldIndex(hDBF, "url");
104
  int docid_field = DBFGetFieldIndex(hDBF, "docid");
105
  int area_field = DBFGetFieldIndex(hDBF, "area_coef");
106 110

  
107
  hSHPHandle = SHPCreate(pszFilename, nSHPType);
111
      //cout<<" DBF Record Count --> "<<iRecord<<endl;
112
      int id_field = DBFGetFieldIndex( hDBF, "ID" );
113
      int url_field = DBFGetFieldIndex( hDBF, "url" );
114
      int docid_field = DBFGetFieldIndex( hDBF, "docid" );
115
      int area_field = DBFGetFieldIndex( hDBF, "area_coef" );
108 116

  
109
  ii = 0;
110
  for (ii = 0; ii < number_data_lines; ii++) {
111
    double area_coef =
112
        sqrt(pow((max_pntx[2][ii] - min_pntx[2][ii]), 2) +
113
             pow((max_pnty[2][ii] - min_pnty[2][ii]), 2));
114
    double ave_x = ((min_pntx[2][ii] + max_pntx[2][ii]) / 2);
115
    double ave_y = ((min_pnty[2][ii] + max_pnty[2][ii]) / 2);
116
    double ave_z = (pointz[2][ii]);
117
      hSHPHandle = SHPCreate( pszFilename, nSHPType );
117 118

  
118
    if (ave_x < 180 && ave_x > -180 && ave_y < 90 && ave_y > -90) {
119
       ii = 0;
120
       for ( ii = 0; ii < number_data_lines; ii++ )
121
       {
122
         double area_coef = sqrt( pow((max_pntx[2][ii]-min_pntx[2][ii]),2) + pow((max_pnty[2][ii]-min_pnty[2][ii]),2)  );
123
         double ave_x = ( (min_pntx[2][ii]+max_pntx[2][ii])/2 );
124
         double ave_y = ( (min_pnty[2][ii]+max_pnty[2][ii])/2 );
125
         double ave_z = ( pointz[2][ii] );
119 126

  
120
      psShape =
121
          SHPCreateObject(SHPT_POINT, ii, 0, NULL, NULL, 1, &ave_x, &ave_y,
122
                          &ave_z, NULL);
127
         if (ave_x < 180 && ave_x > -180 && ave_y < 90 && ave_y >-90 ) {
123 128

  
124
      SHPWriteObject(hSHPHandle, -1, psShape);
125
      SHPDestroyObject(psShape);
126
      //do the update to the dbf file too
127
      iRecord = DBFGetRecordCount(hDBF);
129
         psShape = SHPCreateObject( SHPT_POINT, ii, 0, NULL, NULL, 1, &ave_x, &ave_y, &ave_z, NULL );
128 130

  
129
      DBFWriteStringAttribute(hDBF, iRecord, url_field,
130
                              urlvec[ii].c_str());
131
      DBFWriteStringAttribute(hDBF, iRecord, docid_field,
132
                              docidvec[ii].c_str());
133
      DBFWriteIntegerAttribute(hDBF, iRecord, id_field, int (ii));
134
      DBFWriteDoubleAttribute(hDBF, iRecord, area_field, area_coef);
135
    }
136
  }
137
  //recompute the extents
138
  //SHPComputeExtents( psShape );
139
  //cout << "xmin: " << psShape->dfXMin << " xmax: " << psShape->dfXMax << endl;
140
  //cout << "ymin: " << psShape->dfYMin << " ymax: " << psShape->dfYMax << endl;
141
  DBFClose(hDBF);
142
  SHPClose(hSHPHandle);
131
         SHPWriteObject( hSHPHandle, -1, psShape );
132
         SHPDestroyObject( psShape );
133
         //do the update to the dbf file too
134
         iRecord = DBFGetRecordCount( hDBF );
135

  
136
        DBFWriteStringAttribute(hDBF, iRecord, url_field, urlvec[ii].c_str() );
137
        DBFWriteStringAttribute(hDBF, iRecord, docid_field, docidvec[ii].c_str() );
138
        DBFWriteIntegerAttribute(hDBF, iRecord, id_field, int(ii) );
139
        DBFWriteDoubleAttribute(hDBF, iRecord, area_field, area_coef );
140
        }
141
       }
142
       //recompute the extents
143
       //SHPComputeExtents( psShape );
144
       //cout << "xmin: " << psShape->dfXMin << " xmax: " << psShape->dfXMax << endl;
145
       //cout << "ymin: " << psShape->dfYMin << " ymax: " << psShape->dfYMax << endl;
146
       DBFClose( hDBF );
147
       SHPClose( hSHPHandle );
143 148
}
144 149

  
145 150

  
146 151
/** getUsage -- function that prints to stdout the usage for this driver */
147 152
static void getUsage()
148 153
{
149
  std::cout << "usage: metacat2shape metacat_export.txt test.shp\n\n";
150
  std::cout << "  where:\n\n";
151
  std::
152
      cout <<
153
      "    input -- is an input ASCII file, that contains the following cols:\n";
154
  std::cout << "          -> docid -- the document id\n";
155
  std::cout << "          -> x -- the xlocation\n";
156
  std::cout << "          -> y -- the y location\n";
157
  std::cout << "          -> url -- the url to the document\n";
154
  cout<<"usage: metacat2shape metacat_export.txt test.shp\n\n";
155
  cout<<"  where:\n\n";
156
  cout<<"    input -- is an input ASCII file, that contains the following cols:\n";
157
  cout<<"          -> docid -- the document id\n";
158
  cout<<"          -> x -- the xlocation\n";
159
  cout<<"          -> y -- the y location\n";
160
  cout<<"          -> url -- the url to the document\n";
158 161

  
159
  std::cout << "          shapefile -- {output} is a ESRI shapefile\n\n";
162
  cout<<"          shapefile -- {output} is a ESRI shapefile\n\n";
160 163

  
161
  std::cout << "  see:\n";
162
  std::cout << "  example: metacat2shape metacat_export.txt test.shp\n\n";
164
  cout<<"  see:\n";
165
  cout<<"  example: metacat2shape metacat_export.txt test.shp\n\n";
163 166

  
164
  std::cout << "  ##><><><><><><><><><><><><><><><><><><><><><><><><>##\n";
165
  std::cout << "  ##           John Harris                           ##\n";
166
  std::cout << "  ##           harris@nceas.ucsb.edu                 ##\n";
167
  std::cout << "  ##           Copyright 1999-2003                   ##\n";
168
  std::cout << "  ##><><><><><><><><><><><><><><><><><><><><><><><><>##\n";
167
  cout<<"  ##><><><><><><><><><><><><><><><><><><><><><><><><>##\n";
168
  cout<<"  ##           John Harris                           ##\n";
169
  cout<<"  ##           harris@nceas.ucsb.edu                 ##\n";
170
  cout<<"  ##           Copyright 1999-2003                   ##\n";
171
  cout<<"  ##><><><><><><><><><><><><><><><><><><><><><><><><>##\n";
169 172

  
170
  std::cout << std::endl;
173
  cout << endl;
171 174

  
172 175
}
173 176

  
174 177

  
175 178

  
176
int main(int argc, char **argv)
179
int main( int argc, char * * argv )
177 180
{
178 181
  //get the usage info if the inputs are not right
179
  if (argc != 3) {
182
  if ( argc != 3 )
183
  {
180 184
    getUsage();
181
    exit(1);
185
    exit( 1 );
182 186
  }
187

  
183 188
  //these arrays are for the input x, y, z data
184
  float min_pntx[1000][100];
185
  float min_pnty[1000][100];
186
  float max_pntx[1000][100];
187
  float max_pnty[1000][100];
189
  float min_pntx[1000] [100];
190
  float min_pnty[1000] [100];
191
  float max_pntx[1000] [100];
192
  float max_pnty[1000] [100];
188 193

  
189
  float pointz[1000][100];
190
  vector < string > docidvec;
191
  vector < string > urlvec;
194
  float pointz[1000] [100];
195
  vector<string> docidvec;
196
  vector<string> urlvec;
192 197

  
193
  FILE *infile;
198
  FILE * infile;
194 199
  char oneline[200];
195
  char *value;
200
  char * value;
196 201

  
197 202
  int cnt = 0;
198 203
  int number_lines = 0;
......
205 210

  
206 211
  SHPHandle hSHP;
207 212
  int nShapeType, nEntities, i, iPart;
208
  const char *pszPlus;
213
  const char * pszPlus;
209 214

  
210 215
  //test the reading of the file
211
  if ((infile = fopen(argv[1], "r")) == (FILE *) NULL) {
212
    fprintf(stderr, "Can't read the file: %s.\n", argv[1]);
213
    exit(2);
216
  if ( ( infile = fopen( argv[1], "r" ) ) == ( FILE * ) NULL )
217
  {
218
    fprintf( stderr, "Can't read the file: %s.\n", argv[1] );
219
    exit( 2 );
214 220
  }
215 221

  
216 222
  /* read the data into an array -- first the grid nodes
......
224 230
   * 36.2083333333333
225 231
   * http://metacat.nceas.ucsb.edu/knb/servlet/metacat?action=read&docid=nrs.239.1&qformat=knb
226 232
   */
227
  infile = fopen(argv[1], "r");
228
  char const *out_shape = argv[2];
229
  while (fgets(oneline, 199, infile)) {
230
    sscanf(oneline, "%s %s %s %s %s %s %s", buf_docid, buf_xmin, buf_xmax,
231
           buf_ymin, buf_ymax, buf_url);
233
  infile = fopen( argv[1], "r" );
234
  char const * out_shape = argv[2];
235
  while ( fgets( oneline, 199, infile ) ) {
236
    sscanf( oneline, "%s %s %s %s %s %s %s", buf_docid, buf_xmin, buf_xmax, buf_ymin, buf_ymax, buf_url);
232 237

  
233 238
    /**** cout<<" docid -> " << bufa
234 239
      <<"\n cnt -> " << cnt
......
237 242
      <<"\n p -> " << buf2
238 243
      <<endl; *******/
239 244

  
240
    min_pntx[2][cnt] = atof(buf_xmin);
241
    max_pntx[2][cnt] = atof(buf_xmax);
242
    min_pnty[2][cnt] = atof(buf_ymin);
243
    max_pnty[2][cnt] = atof(buf_ymax);
245
    min_pntx[2] [cnt] = atof(buf_xmin);
246
    max_pntx[2] [cnt] = atof(buf_xmax);
247
    min_pnty[2] [cnt] = atof(buf_ymin);
248
    max_pnty[2] [cnt] = atof(buf_ymax);
244 249

  
245 250
    urlvec.push_back(buf_url);
246 251
    docidvec.push_back(buf_docid);
......
248 253
    cnt++;
249 254
    number_lines = cnt;
250 255
  }
251
  fclose(infile);
256
  fclose( infile );
252 257

  
253
  cout << "creating a new shape file, with " << number_lines << " records "
254
      << endl;
255
  WritePointsArray(SHPT_POINT, out_shape, min_pntx, max_pntx, min_pnty,
256
                   max_pnty, pointz, urlvec, docidvec, number_lines);
258
  cout<<"creating a new shape file, with "<< number_lines <<" records "<<endl;
259
  WritePointsArray( SHPT_POINT,
260
                    out_shape,
261
                    min_pntx,
262
                    max_pntx,
263
                    min_pnty,
264
                    max_pnty,
265
                    pointz,
266
                    urlvec,
267
                    docidvec,
268
                    number_lines );
257 269

  
258 270
#ifdef USE_DBMALLOC
259
  malloc_dump(2);
271
  malloc_dump( 2 );
260 272
#endif
261
  exit(0);
273
  exit( 0 );
262 274
}
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialDataset.java
49 49
    docs = new Vector();
50 50
  }
51 51

  
52
  /**
53
   * Returns XML as a String -- the xml describes the dataset
54
   */
55
   public String toXML () {
56
    StringBuffer _sb = new StringBuffer();
52 57

  
58
    _sb.append("<metacatspatialdataset>");
59
    for (int i = 0; i < docs.size(); i++) {
60
      
61
      MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
62
      
63
      _sb.append("<metacatspatialdocument>\n");
64
    
65
     _sb.append("<creator>");
66
     _sb.append(" <individualName>");
67
     _sb.append("   <givenName></givenName>");
68
     _sb.append("   <surName></surName>");
69
     _sb.append(" </individualName>");
70
     _sb.append(" <organizationName></organizationName>");
71
     _sb.append(" </creator>");
72

  
73
     _sb.append("<title>"+_doc.getTitle()+"</title>");
74
     _sb.append("<docid>"+_doc.getDocid()+"</docid>");
75
     _sb.append(" <extents>");
76
     _sb.append("   <ispoint>"+_doc.getIsPoint()+"</ispoint>");
77
     _sb.append("   <xmin>"+_doc.getXMin()+"</xmin>");
78
     _sb.append("   <ymin>"+_doc.getYMin()+"</ymin>");
79
     _sb.append("   <xmax>"+_doc.getXMax()+"</xmax>");
80
     _sb.append("   <ymax>"+_doc.getYMax()+"</ymax>");
81
     _sb.append(" </extents>\n");
82

  
83
     
84
      _sb.append("</metacatspatialdocument>");
85

  
86
    } 
87
    _sb.append("</metacatspatialdataset>");
88
  
89
    return _sb.toString();
90
   }
91

  
92

  
53 93
  /**
54 94
   * returns the document corresponding to the input index from this dataset
55 95
   */
......
79 119
   * x y z segid 
80 120
   *
81 121
   * the data are delimited by spaces and each line is terminated bt '\n'
122
   * out.println("#HEADER docid x y  url");
82 123
   */
83 124
  public StringBuffer getExtentsDataAsAscii() {
84 125
    StringBuffer _sb = new StringBuffer();
......
86 127
      MetacatSpatialDocument _doc = (MetacatSpatialDocument)docs.elementAt(i);
87 128
      try {
88 129
      if ( ! _doc.getIsPoint() ) {
89
        _sb.append( _doc.getXMin()+ " " + _doc.getYMin() + " 0 " + _doc.getDocid()+"\n");
90
        _sb.append( _doc.getXMax()+ " " + _doc.getYMin() + " 0 " + _doc.getDocid()+"\n");
91
        _sb.append( _doc.getXMax()+ " " + _doc.getYMax() + " 0 " + _doc.getDocid()+"\n");
92
        _sb.append( _doc.getXMin()+ " " + _doc.getYMax() + " 0 " + _doc.getDocid()+"\n");
130
        _sb.append( _doc.getDocid()+" "+ _doc.getXMin()+ " " + _doc.getYMin() + " http://www.cnn.com \n");
131
        _sb.append( _doc.getDocid()+" "+ _doc.getXMax()+ " " + _doc.getYMin() + " http://www.cnn.com \n");
132
        _sb.append( _doc.getDocid()+" "+ _doc.getXMax()+ " " + _doc.getYMax() + " http://www.cnn.com \n");
133
        _sb.append( _doc.getDocid()+" "+ _doc.getXMin()+ " " + _doc.getYMax() + " http://www.cnn.com \n");
93 134
      }
94 135
      } catch (NullPointerException npe) {
95 136
        log.fatal("ERROR: null pointer exception on a spatial document");
src/edu/ucsb/nceas/metacat/spatial/PersistentMetacatSpatialDataset.java
40 40
 * Class for doing IO of spatial data from.  IO can be with the FS in the 
41 41
 * case of a shapefile, and or with a DB (as in the case of a PostGIS 
42 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
 *                                                                       
43 64
 */
44 65
public class PersistentMetacatSpatialDataset {
45 66
  
46 67
  private String textQueryAsciiFile = "/tmp/mso_metacat_textquery.ascii";
47 68
  private String metacatSpatialCacheAsciiFile = "/tmp/mso_metacat_cache.ascii";
69
  private String metacatSpatialCacheShapeFile = "/tmp/mso_metacat_cache.shp";
48 70
  
49 71
  private static Logger log = Logger.getLogger(PersistentMetacatSpatialDataset.class.getName());
50 72
  
......
56 78
  try {
57 79
    PrintStream out = new PrintStream(new FileOutputStream( metacatSpatialCacheAsciiFile));
58 80
    
59
    out.println("#HEADER x y z segid");
81
    out.println("#HEADER docid x y  url");
60 82

  
61 83
    out.println( dataset.getExtentsDataAsAscii());
62 84
    log.fatal("extents data: " + dataset.getExtentsDataAsAscii() +" done" );
63 85

  
64 86
    out.close();
65 87

  
88

  
89
    // make the shapefile 
90
     String command = "metacat_shapefile "+metacatSpatialCacheAsciiFile+" "+metacatSpatialCacheShapeFile;
91
     try{
92
      Process p = Runtime.getRuntime().exec(command);
93
     }
94
     catch(IOException ioe){}
95

  
66 96
  } catch (FileNotFoundException fnfe) {
67 97
    log.fatal("ERROR: could not find the file ");
68 98
    fnfe.printStackTrace();
src/edu/ucsb/nceas/metacat/spatial/SpatialQueryProcessor.java
147 147
      float _docMinX =
148 148
          queryWestBoundingCoordinate((String) _docs.elementAt(i));
149 149

  
150
      String _title = getTitle((String) _docs.elementAt(i));
151

  
150 152
      // check if inside the bounding box
151 153
      if (_docMaxX <= _xmax && _docMinX >= _xmin && _docMaxY <= _ymax && _docMinY >= _ymin ) {
152 154
        MetacatSpatialDocument _doc =
......
212 214
    return _docs;
213 215
  }
214 216

  
217
  /**
218
   * returns the north bounding coordinate -- this is a single point
219
   */
220
  private String getTitle(String docid) {
221
    String title = null;
222
    PreparedStatement pstmt = null;
223
    ResultSet rs = null;
224
    String query = "select docid, nodedata, nodeid from xml_nodes where "
225
        + "nodeid =(select  nodeid from  xml_nodes where docid  like '"
226
        + docid.trim() + "' and nodename like 'title%');";
215 227

  
228
    try {
229
      pstmt = dbconn.prepareStatement(query);
230
      pstmt.execute();
231
      rs = pstmt.getResultSet();
232
      if (rs.next())
233
        title = rs.getString(2);
234
      rs.close();
235
      pstmt.close();
236
    }
237
    catch(Exception e) {
238
      log.error("Error getting docids from queryExtentsByDocid");
239
      e.printStackTrace();
240
    }
241
    return title;
242
  }
243

  
216 244
  /**
217 245
   * returns the north bounding coordinate -- this is a single point
218 246
   */
src/edu/ucsb/nceas/metacat/spatial/MetacatSpatialDocument.java
35 35
  
36 36
  private String docid;
37 37

  
38
  private String title;
39

  
38 40
  private MetacatSpatialExtents extents;
39 41

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

  
46
  
47

  
44 48
  /**
45 49
   * function that registers the document with the Spatial system.  This is 
46 50
   * to be called when the document is inserted to the Metacat system.  At
......
59 63
    this.extents = _extents;
60 64
  }
61 65

  
66
  public String getTitle() { return this.title; }
67
  public void setTitle(String _title) {this.title = _title; }
68

  
62 69
  public float getXMin() { return extents.getXMin(); }
63 70
  public void setXMin(float x) { extents.setXMin(x); }
64 71
  
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
780 780
        out = response.getWriter();
781 781
      
782 782
      // switch -- html/xml print
783
      boolean printXML = false; 
783
      boolean printXML = true; 
784 784
      
785 785
      // get the spatial parameters
786 786
      logMetacat.warn("params: " +  params);
......
802 802
      // return the list of docs and point at the spatial theme 
803 803
      if ( printXML) {
804 804
        response.setContentType("text/xml");
805
        out.println("<?xml version=\"1.0\"?>");
806
        out.println("<urllist>");
807
        //for all data (print url approximations)
808
        for (int i = 0; i < _data.size(); i++) {
809
          out.println("<docid>"+(_data.getDocument(i)).getDocid()+"</docid>"); 
810
          out.println("<url>"+request.getRequestURL()+(_data.getDocument(i)).getDocid()+"</url>");  
811
        } 
812
        out.println("</urllist>");
805
        out.println(_data.toXML() ); // write the data as xml
813 806
        out.close();
814 807
      } else {
815 808
        response.setContentType("text/html");

Also available in: Unified diff