Hello,

I have prepared a simple prototype OGC Client solution with GEOTOOLS API 2.2
for OGC test.

The realisation of WfsService class you can find below.
GEOSERVER provides 729 features as response of  GetFeatures request.

I have the following problem:

1)      If I make a instance of this class and call doOgcQuery from a main class
:
           a.   For translation and runtime I need 4 library file
(gt2-api-2.2. geoapi-2.0, gt2-main-2.2. gt2-wfs )
           b.   The running time is 4 sec
2)      If I make a instance of this class and call doOgcQuery from a JSP Web
Side:
           a.   For translation I need 4 library file (gt2-api-2.2.
geoapi-2.0, gt2-main-2.2. gt2-wfs )
           b.   For runtime I need many more library from geotools
           c.   The running time is more than 20 sec.
Of course it is not acceptable, but I?m sure something is not correct on my
Side.

Please help me to find what can be wrong.

Best Regards

Balazs


-----


public class OgcWfsService {
    
    String Seturl = "http://geoserver:8080/geoserver/wfs";;
    String featureType = "wisa:MESSKOERPER_VIEW";
    DataStore wfs;
    int FeatureIndex=0;

    public OgcWfsService() {
try{
            URL url = new URL(Seturl);
            
            Map m = new HashMap();
             WFSDataStoreFactory lwfs = new WFSDataStoreFactory();
            m.put(lwfs.URL.key,url);
            m.put(lwfs.TIMEOUT.key,new Integer(10000));
            m.put(lwfs.PROTOCOL.key,Boolean.FALSE);
            wfs = lwfs.createNewDataStore(m);
            int i=0;
            for ( i=0; i<wfs.getTypeNames().length; i++)
                        if 
(wfs.getTypeNames()[i].equals(featureType))FeatureIndex
= i;
            //** TO DO !!!!!!!!!!!!!!!
            //** exeption if find no element ****/
    }catch(IOException e){
            e.printStackTrace();
    } catch (NoSuchElementException e) {
            e.printStackTrace();
                    }
    }
    public List doOgcQuery(String SqlQuery) throws IOException,
IllegalAttributeException{
        List result= new ArrayList(1600);
        Feature FeatureElement = null;
        String h1,h2;
        HashMap resultHashMap = null;
      
        Query query = new DefaultQuery(wfs.getTypeNames()[FeatureIndex]);
        FeatureReader ft =
wfs.getFeatureReader(query,Transaction.AUTO_COMMIT);
        int i=0;
       while(ft.hasNext()){
            try {
                FeatureElement = ft.next();
            } catch (NoSuchElementException e) {
                System.err.println("Error: no more element even if feature
reader hasNext returns true");
                e.printStackTrace(System.err);
                break;
            } 
           if(!FeatureElement.equals(null)){
                resultHashMap = new HashMap();
               
resultHashMap.put("NAME",FeatureElement.getAttribute("NAME"));
               
resultHashMap.put("HZB_NUMMER",FeatureElement.getAttribute("ID"));
                result.add(resultHashMap);
                
           } 
        
        }
       
//        java.util.List list =Arrays.asList(result.toArray());
        for (i=0; i<result.toArray().length ; i++)
            System.out.print(result.toArray()[i]+ "\n");
        return result;
   }
 
}

-- 
View this message in context: 
http://www.nabble.com/Performance-different-between-Web-and-App-context-tf2337316.html#a6503553
Sent from the geotools-gt2-users mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to