[OpenLayers-Users] displaying attribute content in wfs

Alexandre Dubé adube at mapgears.com
Mon Aug 6 05:52:01 PDT 2012


Pedro,

   Take a look at this example[1].  In your browser console, look at the 
map.layers[1].features[0].attributes property, which get automatically 
populated with key/values of attributes from your database.  In order to 
achieve that with your wfs layer, you need to set up a vector layer 
using the WFS protocol, as the example demonstrates.

   Then, you can move on to the selection and browse the attributes and 
display them as you want.

   Here's an old demo that features all the above and even more [2].  
Look a the main.js [3] file, search for the onFeatureSelect method to 
see how it works.  Please note that the demo uses the cluster strategy.

HTH,

Alexandre


[1] http://openlayers.org/dev/examples/wfs-states.html
[2] http://dev4.mapgears.com/ebdata/demo-pim/
[3] http://dev4.mapgears.com/ebdata/demo-pim/main.js


On 12-08-06 05:33 AM, Pedro Costa wrote:
> Guys,
>
> Thank you for your help but maybe I have not properly explained.
> I really want add a popup like this example[1] but what I want it to 
> appear are attributes not like area or length but text attributes like 
> name saved on my postgis database.
> So my question is how i do for openlayer show this type of attributes 
> that are already draw and stored on my database.
>
> Thanks
>
>
>
> [1] http://openlayers.org/dev/examples/select-feature-openpopup.html
>
>
>
>
> Em 01-08-2012 19:35, Alexandre Dubé escreveu:
>> Hi Pedro,
>>
>>   Using an OpenLayers.Control.Select control, it's just a matter of 
>> displaying the feature.attributes when a feature is clicked. See the 
>> following example, it should give you a good start :
>>
>> http://openlayers.org/dev/examples/select-feature-openpopup.html
>>
>> HTH,
>>
>> Alexandre
>>
>>
>> On 12-08-01 11:29 AM, Pedro Costa wrote:
>>> Hi guys,
>>>
>>> In my map i have a wfs layer that i want display content of one 
>>> attribute (postgis table) by feature click.
>>> Can you help me the better choice to that?
>>>
>>> I see examples with wms...
>>>
>>> Thanks
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/openlayers-users
>>
>>
>


-- 
Alexandre Dubé
Mapgears
www.mapgears.com



More information about the Users mailing list