Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[udig-devel] Filtering datas from a database

Hi uDig'gers ! I am new on the uDig world and I am having some troubles while trying to filter some datas from an Oracle database.

I have a database that consist of a set of tables : three of them contain spatial informations. I am able to retrieve the whole content of a given table, but now I would like to filter datas to be displayed on a map : particularly, I would like to filter only geometries corresponding to a given ID.

Here is the snippet of code I got currently :

    IServiceFactory factory = CatalogPlugin.getDefault().getServiceFactory();
    for (IService service : factory.createService(params)) { // params is the map containing informations to connect to the database
        if( service.canResolve(OracleDataStore.class )){
            try {
                OracleDataStore database = service.resolve(OracleDataStore.class, new NullProgressMonitor());
                // This statement allows me to retrieve datas only for the LOCATION_POINT table ...
                FeatureSource<SimpleFeatureType, SimpleFeature> featureSource = database.getFeatureSource("LOCATION_POINT");
                // Add here filter [1]

                List<IGeoResource> resourceList = new ArrayList<IGeoResource>();
                for (IResolve nextElt : service.members(new NullProgressMonitor())) {
                    if (nextElt instanceof IGeoResource) {
                        resourceList.add((IGeoResource) nextElt);
                    }
                }
                ApplicationGIS.addLayersToMap(ApplicationGIS.getActiveMap(), resourceList, 1, null, true);
            } catch (Exception e) {
                e.printStackTrace();
            }
       }
    }

Then, I tried the following to only filter a particular row of my table :

    // This code should go to the [1]
    FilterFactory ff = new FilterFactoryImpl();
    Filter myFilter = ff.id(Collections.singleton(ff.featureId("LOCATION_POINT.681")));

... but with no success :-/

Any help would be appreciated.

Regards,
--
Anyware Technologies
Jacques LESCOT
Project Manager
Eclipse Technical Expert
jacques.lescot@xxxxxxxxxxxxxxxx
Standard : +33(0)5 61 00 52 90
Direct : +33(0)5 61 00 06 60
Mobile : +33(0)6 74 49 23 34
Fax : +33(0)5 61 00 51 46
Anyware Technologies
Lake Park
ZAC de l'Hers - Allée du Lac
BP 87216
31672 Labège Cedex
France
www.anyware-tech.com
This message and any attachments (the "Message") are confidential and intended solely for the addressees.
Any unauthorized modification, edition, use or dissemination is prohibited.
Neither Anyware Technologies nor its headquarters Wavecom shall be liable for the Message if altered, changed, falsified or edited, diffused without authorization.

Back to the top