|
From: Jon B. <jon...@go...> - 2011-04-20 14:37:22
|
Hi Alex,
Thanks for the response, that seems to work! Just out of curiosity, is there
a way of displaying a WFS layer without specifying its namespace - with just
a url and a layer name?
Thanks,
Jon
On 20 April 2011 13:36, Alexandre Ascasibar Sequeiros <aas...@gm...>wrote:
> You're missing a CallBack object to populate all the features retrieved
> from geoserver in the layer and a proxy to get data from the server in
> Javascript.
> Have a look to my code, it works for me.
>
>
> OpenLayers.setProxyHost("gwtOpenLayersProxy?targetURL=");
>
> VectorOptions vectorOptions = new VectorOptions();
> Vector eventsLayer = new Vector("Events", vectorOptions);
>
> WFSProtocolOptions wfsProtocolOptions = new
> WFSProtocolOptions("http://your-host/geoserver/ows","your-namespace",
> "your-wfs-layer");
> wfsProtocolOptions.setGeometryName(your-geometry-field);
> wfsProtocolOptions.setSrsName("EPSG:4326");
> wfsProtocolOptions.setVersion("1.1.0");
>
>
> WFSProtocol wfsProtocol = new
> WFSProtocol(wfsProtocolOptions);
> // WFS Protocol is asynchronous, so we need to use a
> callback
> Callback callback = new Callback() {
> public void computeResponse(Response response) {
> try
> {
> VectorFeature[] features =
> response.getFeatures();
> for ( VectorFeature feature :
> features ) {
> //Apply style
> depending on any attribute of you feature
> Style style = new
> Style();
>
> style.setPointRadius(5);
>
> style.setFillColor("#00FF00");
>
> feature.setStyle(style);
> }
> eventsLayer.addFeatures(features);
>
> }
> catch (Exception ex)
> {
> //ERROR
> }
> }
> };
> WFSProtocolCRUDOptions options = new
> WFSProtocolCRUDOptions(callback);
> wfsProtocol.read(options);
>
>
> Hope it helps,
> Alex.
> ________________________________________
> De: Jon Britton [jon...@go...]
> Enviado el: miércoles, 20 de abril de 2011 13:12
> Para: gwt-openlayers-users
> Asunto: [Gwt-openlayers-users] WFS layers with GWT-OpenLayers
>
> Hi,
>
> I'm trying to add a WFS layer to my map but it's not displaying. Here is my
> code:
>
>
> WFSProtocolOptions wfsProtocolOptions = new WFSProtocolOptions();
> wfsProtocolOptions.setUrl(featureType.getServiceUrl());
> wfsProtocolOptions.setFeatureType(featureType.getName());
> WFSProtocol wfsProtocol = new WFSProtocol(wfsProtocolOptions);
> VectorOptions vectorOptions = new VectorOptions();
> vectorOptions.setProtocol(wfsProtocol);
> vectorOptions.setStrategies(new Strategy[]{new BBoxStrategy()});
>
> mapLayer = new Vector(featureType.getName(), vectorOptions);
>
> SmartWPS.getSmartWPS().getMap().addLayer(mapLayer);
>
>
> Where the url is "http://li199-25.members.linode.com:8080/geoserver/wfs"
> and the layer name is "topp:tasmania_roads". I got this code from the
> showcase so I assumed it was all I needed.
>
> Am I missing something? BTW the WFS is public if anybody wants to try it
> out :-)
>
> Thanks,
>
> Jon
>
> ______________________
> 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.
>
> ______________________
>
>
>
> ------------------------------------------------------------------------------
> Benefiting from Server Virtualization: Beyond Initial Workload
> Consolidation -- Increasing the use of server virtualization is a top
> priority.Virtualization can reduce costs, simplify management, and improve
> application availability and disaster protection. Learn more about boosting
> the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
> _______________________________________________
> Gwt-openlayers-users mailing list
> Gwt...@li...
> https://lists.sourceforge.net/lists/listinfo/gwt-openlayers-users
>
|