[OpenLayers-Users] searching a feature with open layers

Arnd Wippermann arnd.wippermann at web.de
Tue Nov 20 11:44:52 EST 2007


Hi,

When you look at the source, you can see, that I overwrite the function
OpenLayers.Util.getParameterString to prevent encoding. There seems a bit of
trouble with encoding in OpenLayers. Why it works, I don't know, but the
example run.

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/


 

-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von goeserver developer
Gesendet: Dienstag, 20. November 2007 12:19
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] searching a feature with open layers


the following code doesn't work. If I remove the filter WFS displays the
first feature. I am working on geoserver. Even filter in the layer
initialisation doesn't work.

var	Filter
="<Filter><PropertyIsEqualTo><PropertyName>STATE_NAME</PropertyName><Literal
Texas</Literal></PropertyIsEqualTo></Filter>";
layerWFS = new OpenLayers.Layer.WFS( "WFS States",
"http://localhost:8080/geoserver/wfs?",
         					{typename:
"states",maxfeatures: 1}, {
      						 extractAttributes: true});
     						 
	
layerWFS.mergeNewParams({'filter' : Filter }); 
                   layerWFS.style.strokeColor = "#ff0000"; 
	
map.addLayer(layerWFS);

Any help is appreciated.
Thanks



Arnd Wippermann wrote:
> 
> You can apply a filter to the WFS layer. 
> WFSlayer.mergeNewParams({'filter' : yourFilter });
> 
> But this works only, if the filtered feature is visible in the current 
> extent of the map. If you know the centerpoint of the features, you 
> can set a new center for the map after applying the filter.
> 
> Example:http://gis.ibbeck.de/ginfo/apps/OLExamples/SphericalMercator/w
> fs_fil
> ter.html
> 
> Mit freundlichen Grüssen
> 
> Arnd Wippermann
> http://gis.ibbeck.de/ginfo/
> 
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: bjoice at firstam.com [mailto:bjoice at firstam.com]
> Gesendet: Freitag, 16. November 2007 08:55
> An: arnd.wippermann at web.de
> Betreff: RE: [OpenLayers-Users] searching a feature with open layers
> 
> Hi,
> 
> Thanks,
> I would like to know , can I pass the value of an attribute (eg : In 
> top:states , can pass STATE_name ="texas')  instead of maxfeatures 
> with OpenLayers.Layer.WFS.
> Thanks, . 
> 
> -----Original Message-----
> From: arnd.wippermann at web.de [mailto:arnd.wippermann at web.de]
> Sent: Thursday, November 15, 2007 10:40 PM
> To: Joice, Binny
> Cc: users at openlayers.org
> Subject: AW: [OpenLayers-Users] searching a feature with open layers
> 
> Hi,
> 
> You can load your WFS with OpenLayers with option 'extractAttributes':
> true.
> 
> 
>     //OpenLayers.ProxyHost for WFS needed!!!
>     layerWFS = new OpenLayers.Layer.WFS( "WFS Titel", WFS_Url,
>         {typename: "POLYGONS", maxfeatures: 500}, { typename: 
> "POLYGONS",
> extractAttributes: true});
>  
> Now you have access to the features geometry and the features attributes.
> 
> Mit freundlichen Grüssen
> 
> Arnd Wippermann
> http://gis.ibbeck.de/ginfo/apps/OLExamples/SphericalMercator/OL_900913
> _frame
> s.html
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] Im Auftrag von goeserver 
> developer
> Gesendet: Donnerstag, 15. November 2007 07:31
> An: users at openlayers.org
> Betreff: Re: [OpenLayers-Users] searching a feature with open layers
> 
> 
> Hi,
> 
> Thanks,
> Suppose I have a layer like states , I need to spatially locate , a 
> particular feature (like : name =texas)it on the map . With javascipt 
> and WFS I am able to do it . But with openlayers ,how could it be done.
> 
> 
> Eric Lemoine-3 wrote:
>> 
>> On Nov 13, 2007 1:19 PM, goeserver developer <bjoice at firstam.com> wrote:
>>>
>>> Hi,
>>>
>>> How can I include a search ? I am displaying the topp:states layer 
>>> along with google map with openlayers. I also want to include a 
>>> textbox where I can key in the state name to search. How will 
>>> geoserver
> do the WFS part?
>>> Can it be done with Geojson.
>> 
>> I'm not sure I fully understand your need, but you may be interested 
>> in this example:
>> <http://www.openlayers.org/dev/examples/getfeatureinfo.html>. WMS 
>> GetFeatureInfo is used on each click in this example.
>> 
>> --
>> Eric
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>> 
>> 
> 
> --
> View this message in context:
> http://www.nabble.com/searching-a-feature-with-open-layers-tf4797435.h
> tml#a1
> 3761443
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> **********************************************************************
> This message contains confidential information intended only for the 
> use of the addressee(s) named above and may contain information that 
> is legally privileged.  If you are not the addressee, or the person 
> responsible for delivering it to the addressee, you are hereby 
> notified that reading, disseminating, distributing or copying this 
> message is strictly prohibited.
> If you have received this message by mistake, please immediately 
> notify us by replying to the message and delete the original message 
> immediately thereafter.
> 
> Thank you.
>                                     FADLD Tag
> **********************************************************************
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

--
View this message in context:
http://www.nabble.com/searching-a-feature-with-open-layers-tf4797435.html#a1
3855172
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list