[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [udig-devel] Filtering datas from a database
|
That is the selection (poorly named I know)
On 19-Dec-08, at 10:59 AM, Ugo Taddei wrote:
oh, right. I knew I had seen this code somewhere in our app (we do
data filtering like described by Jacques):
getLayer
().getStyleBlackboard
().put(ProjectBlackboardConstants.LAYER__DATA_QUERY, filter);
I thought it was layer.setFilter. So, what's setFilter for?
Ugo
Jesse Eichar wrote:
Hi,
We need to rename the packages from internal to something less
frightening. When it comes to net.refractions.udig.project the
internal packages can be used but NOT the internal.impl packages.
The idea was to make people reluctant to use the internal classes
because most of the things should be done with Commands not
direct. Commands allow roll-back. Problem was that for setting up
maps and so on it is annoying to do it through commands.
As for filtering features I would recommend trying to make use of
the view work. It has a couple bugs but in general works. The way
to do it is to put a Filter on the styleblackboard with the key:
net
.refractions
.udig
.project
.ProjectBlackboardConstants
.ProjectBlackboardConstants.LAYER__DATA_QUERY Jesse
On 19-Dec-08, at 10:24 AM, Jacques LESCOT wrote:
Thanks for your quick answer.
Unfortunately, I have still the same problem.
I will try to reformulate : I have a table called LOCATION_POINT
with two fields (an ID and a LOCATION - the spatial information
for the geometry). I could have lot of datas (1000+) in this table
and I would like to retrieve ONLY the data with a given ID, and
then show the associated geometry (a Point in this case) on a Map.
I want to execute a request llike SELECT * FROM LOCATION_POINT
WHERE ID="681"
I think there should be a generic way to ask such a thing through
Geotools (any example on how this could be achieved on a
ShapeFile ? Assuming behavior should be the same with a database)
using request/filtering capabilities, but I can not figure out how
to get it working.
Any clue ?
Here are some inline comments on your last answser,
Ugo Taddei a écrit :
Hello Jacques,
you'll find a Layer.setFilter(Filter). This should work for you.
But you
must set after
The Layer class is defined inside an internal package : should it
be directly used by clients ?
ApplicationGIS.addLayersToMap(ApplicationGIS.getActiveMap(),
resourceList, 1, null, true);
and not in the loop. That is, when you have the layer. The effect
should
be the same, however, only it's a higher level approach. udig
would sort
the issues with the actual data store out.
The result of adding a Filter on a Layer is that all datas are
displayed, and those satisfying my filter are selected with a
black rectangle. My need is to filter datas before retrieving them
from the database.
You seem to be going too deep when you're asking for a
OracleDataStore.
It'd be interesting to know whether there's any performance
benefit from
this. (I guess not.)
Yes you are probably right : no need to cast absolutely into an
OracleDataStore.
Regards,
Jacques
Hope that helps.
Cheers,
Ugo
Jacques LESCOT said:
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 <http://www.anyware-tech.com>
*Jacques LESCOT*
Project Manager
Eclipse Technical Expert
jacques.lescot@xxxxxxxxxxxxxxxx <mailto: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 <http://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.
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
--
<Signature_AWT.jpg> 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.
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
------------------------------------------------------------------------
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
--
Ugo Taddei
Fraunhofer Institut Intelligente Analyse- und Informationssysteme
(FhG IAIS)
http://www.iais.fraunhofer.de
Department Knowledge Discovery - IAIS.KD -
Working Group Spatial Decision Support
http://www.iais.fraunhofer.de/kd.html
phone (+49)2241-14-2184 fax (+49)2241-14-2072
Schloss Birlinghoven, D-53754 Sankt Augustin, Germany
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel