Project

General

Profile

« Previous | Next » 

Revision 3028

Added by perry over 18 years ago

Fixed parameter order for call to createSpatialQuery and fixed bounding box intersection logic.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatServlet.java
3 3
 *    Purpose: A Class that implements a metadata catalog as a java Servlet
4 4
 *  Copyright: 2000 Regents of the University of California and the
5 5
 *             National Center for Ecological Analysis and Synthesis
6
 *    Authors: Matt Jones, Dan Higgins, Jivka Bojilova, Chad Berkley
6
 *    Authors: Matt Jones, Dan Higgins, Jivka Bojilova, Chad Berkley, Matthew Perry
7 7
 *    Release: @release@
8 8
 *
9 9
 *   '$Author$'
......
807 807
      logMetacat.debug("\nxmax: " + _xmax + " \nymax:" + _ymax +
808 808
                      "\nxmin: " + _xmin + "\nymin: " + _ymin);
809 809

  
810
      // create an s-query
811
      String spatialQuery = createSpatialQuery(_xmin, _ymin, _xmax, _ymax);
812
      String[] queryArray = new String[1];
813
      queryArray[0] = spatialQuery;
814
      params.put("query", queryArray);
810 815

  
816
      // qformat
817
      String[] qformatArray = new String[1];
818
      try {
819
          String _skin = ((String[]) params.get("SKIN"))[0];
820
          qformatArray[0] = _skin;
821
      } catch (java.lang.NullPointerException e) {
822
          // should be "default" but keep this for backwards compatibility with knp site
823
          logMetacat.warn("No SKIN specified for metacat actions=spatial_query... defaulting to 'knp' skin !\n");
824
          qformatArray[0] = "knp";
825
      }
826
      params.put("qformat", qformatArray);
811 827

  
828
      // change the action
829
      String[] actionArray = new String[1];
830
      actionArray[0] = "squery";
831
      params.put("action", actionArray);
832

  
833
      handleSQuery(out, params, response, username, groupnames, sess_id);
834

  
835

  
836
/* MBJ DELETED -- using Metacat query instead
812 837
      // issue the Spatial query 
813 838
      //MBJ DELETED MetacatSpatialDataset _data =  
814 839
        //MBJ DELETED _spatialQuery.queryDatasetByCartesianBounds(_xmin, _ymin, _xmax, _ymax);
......
817 842
      //MBJ DELETED logMetacat.warn("\nThe number of documents in the BBOX query: " 
818 843
              //MBJ DELETED + _data.size()+" the doc. list: '" + _data.toTXT().trim()+"'" );
819 844
     
820
/* MBJ DELETED -- using Metacat query instead
821 845
if (  _data.size() > 0) { 
822 846
      logMetacat.warn("\nThe number of documents in the BBOX query: " 
823 847
              + _data.size()+" the doc. list: '" + _data.toTXT().trim()+"'" );
......
853 877
        out.close();
854 878
}
855 879
*/
856
      	// create an s-query
857
        String spatialQuery = createSpatialQuery(_xmax, _ymax, _xmin, _ymin);
858
      	String[] queryArray = new String[1];
859
      	queryArray[0] = spatialQuery;
860
      	params.put("query", queryArray);
861
      	
862
      	// qformat        
863
      	String[] qformatArray = new String[1];
864
      	qformatArray[0] = "knp";
865
      	params.put("qformat", qformatArray);
866
	
867
      	// change the action 
868
      	String[] actionArray = new String[1];
869
      	actionArray[0] = "squery";
870
      	params.put("action", actionArray);
871 880

  
872
        handleSQuery(out, params, response, username, groupnames, sess_id);  
873 881
    }
874 882

  
875 883
    /**
......
900 908
	sb.append("<returnfield>idinfo/citation/citeinfo/origin</returnfield>");
901 909
	sb.append("<returnfield>idinfo/keywords/theme/themekey</returnfield>");
902 910
	sb.append("<querygroup operator=\"INTERSECT\">");
903
	sb.append("<queryterm searchmode=\"less-than\" casesensitive=\"false\">");
911
	sb.append("<queryterm searchmode=\"greater-than\" casesensitive=\"false\">");
904 912
	sb.append("<value>" + _ymin + "</value>");
905 913
	sb.append("<pathexpr>northBoundingCoordinate</pathexpr>");
906 914
	sb.append("</queryterm>");
907
	sb.append("<queryterm searchmode=\"greater-than\" casesensitive=\"false\">");
915
	sb.append("<queryterm searchmode=\"less-than\" casesensitive=\"false\">");
908 916
	sb.append("<value>" + _ymax + "</value>");
909
	sb.append("<pathexpr>northBoundingCoordinate</pathexpr>");
917
	sb.append("<pathexpr>southBoundingCoordinate</pathexpr>");
910 918
	sb.append("</queryterm>");
911
	sb.append("<queryterm searchmode=\"less-than\" casesensitive=\"false\">");
919
	sb.append("<queryterm searchmode=\"greater-than\" casesensitive=\"false\">");
912 920
	sb.append("<value>" + _xmin + "</value>");
913
	sb.append("<pathexpr>westBoundingCoordinate</pathexpr>");
921
	sb.append("<pathexpr>eastBoundingCoordinate</pathexpr>");
914 922
	sb.append("</queryterm>");
915
	sb.append("<queryterm searchmode=\"greater-than\" casesensitive=\"false\">");
923
 	sb.append("<queryterm searchmode=\"less-than\" casesensitive=\"false\">");
916 924
	sb.append("<value>" + _xmax + "</value>");
917 925
	sb.append("<pathexpr>westBoundingCoordinate</pathexpr>");
918 926
	sb.append("</queryterm>");

Also available in: Unified diff