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] [[email protected]] En nombre de Joaquín Rodriguez-Guerra Urcelay [[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 = 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] [[email protected]] En nombre de Joaquín Rodriguez-Guerra Urcelay [[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] [[email protected]] En nombre de Joaquín Rodriguez-Guerra Urcelay [[email protected]] Enviado el: miércoles, 29 de junio de 2011 11:07 Para: [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
