I think there might be a bug still, the following code does not always return
the right SIZE when using WFS_STRATEGY "mapserver" in my tests...
java.util.Map<String, Serializable> params = new
HashMap<String, Serializable>();
params.put(org.geotools.data.wfs.WFSDataStoreFactory.URL.key, url);
params.put(org.geotools.data.wfs.WFSDataStoreFactory.WFS_STRATEGY.key,"strict");
handle = catalog.acquire(params, new
NullProgressMonitor());
if (handle != null) {
List<IGeoResource> resources =
(List<IGeoResource>) handle.resources(new NullProgressMonitor());
// in this case on wms server may contain many
layers
for (IGeoResource resource : resources) {
Layer layer = null;
String layerId =
resource.getIdentifier().toString();
if
(layerId.compareToIgnoreCase(Constants.MAPSERVER_GETCAPABILITIES_WFS + "#" +
Constants.GEORESOURCE_POSITION_REAL) == 0) {
layer =
layerFactory.createLayer(resource);
layer.setName(Constants.LAYER_POSITION_REAL);
map.sendCommandASync(new
AddLayerCommand((Layer) layer));
}
}
}
Layer mylayer = map.getLayersInternal().get(0);
FeatureSource source =
mylayer.getResource(FeatureSource.class, null);
if (source!=null){
FeatureCollection features =
source.getFeatures();
System.out.println("SIZE "+ features.size());
}
However If I use another WFS_STRATEGY, like "strict", it works correctly, so
the problem is not important. I tried to dig in in the code, but I think this
parameters is used somewhere in getools, and not udig... I dont know really.
Thanks!
Joaquín
________________________________________
De: [email protected]
[[email protected]] En nombre de Jody Garnett
[[email protected]]
Enviado el: jueves, 30 de junio de 2011 12:10
Para: User-friendly Desktop Internet GIS
Asunto: Re: [udig-devel] layer.getResource(FeatureSource.class, null) refreshing
great! Want to close the issue or is their still work to do?
--
Jody Garnett
On Thursday, 30 June 2011 at 5:58 PM, Joaquín Rodriguez-Guerra Urcelay wrote:
Finally I solved my problem by using a "strict" WFS STRATEGY. This way,
getFeatures works correctly and highlighting features in mapserver still works
as if I were using a "mapserver" WFS STRATEGY.
Regards,
Joaquín
________________________________________
De:
[email protected]<mailto:[email protected]>
[[email protected]<mailto:[email protected]>]
En nombre de Joaquín Rodriguez-Guerra Urcelay
[[email protected]<mailto:[email protected]>]
Enviado el: miércoles, 29 de junio de 2011 17:42
Para: User-friendly Desktop Internet GIS
Asunto: Re: [udig-devel] layer.getResource(FeatureSource.class, null) refreshing
Actually, it occurs if the layer is created from a wfs data store using the
mapserver WFS_STRATEGY like this:
java.util.Map<String, Serializable> params =D new HashMap<String,
Serializable>();
params.put(org.geotools.data.wfs.WFSDataStoreFactory.URL.key,url);
params.put(org.geotools.data.wfs.WFSDataStoreFactory.WFS_STRATEGY.key,"mapserver");
handle = catalog.acquire(params, new NullProgressMonitor());
If the WFS_STRATEGY param is not defined, then the getFeatures works correclty
:)
So it seems like a bug introduced when adding the mapserver wfs_strategy.
________________________________________
De:
[email protected]<mailto:[email protected]>
[[email protected]<mailto:[email protected]>]
En nombre de Joaquín Rodriguez-Guerra Urcelay
[[email protected]<mailto:[email protected]>]
Enviado el: miércoles, 29 de junio de 2011 17:07
Para: User-friendly Desktop Internet GIS
Asunto: Re: [udig-devel] layer.getResource(FeatureSource.class, null) refreshing
Hello Jody,
I have found out that this problem only happens when using the udig 1.2
SNAPSHOT that you created with the new version of geotools to fix the mapserver
compatibility.
- udig sdk 1.2.1 works ok, and getFeatures always returns all features.
- udig sdk 1.2 SNAPSHOT getFeatures does not alway return all features, most
times some of them are left out :s
Regards,
Joaquín
________________________________________
De:
[email protected]<mailto:[email protected]>
[[email protected]<mailto:[email protected]>]
En nombre de Joaquín Rodriguez-Guerra Urcelay
[[email protected]<mailto:[email protected]>]
Enviado el: miércoles, 29 de junio de 2011 11:07
Para: [email protected]<mailto:[email protected]>
Asunto: [udig-devel] layer.getResource(FeatureSource.class, null) refreshing
Hello,
I am having a little problem retrieving features from a layer object, and I
dont know if it is normal or not.
The following typical code is not returning up to date results in my udig app.
FeatureSource source = layer.getResource(FeatureSource.class, null);
if (source!=null){
FeatureCollection features = source.getFeatures();
System.out.println("SIZE "+ features.size());
}
The layer is a WFS layer from mapserver which access a mysql database, and as
mapserver does not support WFS-T, I am inserting new features directly into the
database.
INSERT INTO positionReal(id, msGeometry) VALUES (8, GeomFromText('POINT(-4
8.2)',4326));
I can see that after executing this sql insert, the new feature is displayed in
the map as soon as I refresh the layer or I pan or do any getMap request, which
is great :)
Also, the getFeature request to the server returns a list with the new feature
:
http://localhost:8080/cgi-bin/mywfs?SERVICE=WFS&VERSION=1.0.0&request=getfeature&typename=PositionReal
:)
But the code above sometimes (most times) keeps returning the old list of
features without the new point.
Do you have any idea why? Is there any way to update the FeatureSource? maybe
it is using some kind of cache....
I wonder why rendering the wfs layer, which probably uses a similar code,
detects the new feature, and this code does not...
Thank you!!!
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel
______________________
This message including any attachments may contain confidential
information, according to our Information Security Management System,
and intended solely for a specific individual to whom they are addressed.
Any unauthorised copy, disclosure or distribution of this message
is strictly forbidden. If you have received this transmission in error,
please notify the sender immediately and delete it.
______________________
Este mensaje, y en su caso, cualquier fichero anexo al mismo,
puede contener informacion clasificada por su emisor como confidencial
en el marco de su Sistema de Gestion de Seguridad de la
Informacion siendo para uso exclusivo del destinatario, quedando
prohibida su divulgacion copia o distribucion a terceros sin la
autorizacion expresa del remitente. Si Vd. ha recibido este mensaje
erroneamente, se ruega lo notifique al remitente y proceda a su borrado.
Gracias por su colaboracion.
______________________
_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel