[OpenLayers-Users] Getting all points for a geom?

Adorian Ardelean mynature at gmail.com
Mon Dec 8 09:18:31 EST 2008


Hi Guillermo,

I have not tried it with a WFS layer, but I think it should work (I infer by
looking at other examples on this list).
You may add the control when you initialize the rest of other controls you
use. The "..." stands for other controls :-)

I think you have to create the layer before you create the controls for it.
Just follow regular init() code as in other OL examples. Then when you want
to get a feature info you may use some code to activate the featureinfocontrol
(by click on a form entity, or image etc. associated with a "toggle"
function).

All the best,
Adorian


On Mon, Dec 8, 2008 at 2:53 PM, Guillermo Lopez Mackinnon <
gmlopez.mackinnon at gmail.com> wrote:

> Hey! Many thanks!
> That sounds like a great hint and like the correct approach too :-)!
>
> What should I do with the controls variable? Add it to the layer at
> creation time?
>
> For example:
>
> controls = {
> ...
> featureinfocontrol: new OpenLayers.Control.SelectFeature(myvectorlayer,
> {onSelect: featureinfo});
> }
>
> var cities = new OpenLayers.Layer.WFS(
>                 "Cities",
>                 "http://localhost:8080/geoserver/wfs",
>                 {typename: 'topp:cities'},
>                 {
>                     typename: 'cities',
>                     featureNS: 'http://www.openplans.org/topp',
>                     extractAttributes: true,
>                     controls: controls
>
>                 }
>             );
>
> Is the code above correct? Did I understand correctly or do I have to add
> this control to the map as the other controls?
>
> I'll try it out and let you know in case I have any problem. If it works
> I'll post the solution.
>
>
> Guillermo
>
>
> On Mon, Dec 8, 2008 at 1:30 PM, Adorian Ardelean <mynature at gmail.com>wrote:
>
>> Hi Guillermo,
>>
>> Look if you can use:
>> *feature.attributes["city_name"]*
>>
>> example
>> featureinfo = function(feature)
>> {
>> alert(*feature.attributes["city_name"])*;
>> }
>>
>> controls = {
>> ...
>> featureinfocontrol: new OpenLayers.Control.SelectFeature(myvectorlayer,
>> {onSelect: featureinfo});
>> }
>> ...
>>
>> All the best,
>> Adorian
>>
>>
>>
>> On Mon, Dec 8, 2008 at 12:37 PM, Guillermo Lopez Mackinnon <
>> gmlopez.mackinnon at gmail.com> wrote:
>>
>>> Thanks for your reply!
>>> Actually, I meant the feature attributes like for instance "city_name",
>>> "population" and so on. I´d like to display some of them when the user
>>> clicks on a feature and since I may have several layers, doing it in the way
>>> I explained in my initial post it'll be pretty tedious so I'd say it should
>>> be some other way (a correct way) of doing this kind of stuff. Am I right?
>>>
>>>
>>> Thanks again for your help!
>>>
>>> Guillermo
>>>
>>>
>>> On Mon, Dec 8, 2008 at 11:40 AM, Adorian Ardelean <mynature at gmail.com>wrote:
>>>
>>>> Hi Nino,
>>>>
>>>> Do you mean all nodes of a polygon? If yes, you could explore Vector
>>>> Formats Example in http://openlayers.org/dev/examples/ where is shows
>>>> also how you could output coordinates of a feature in various formats.
>>>>
>>>> All the best,
>>>> Adorian
>>>>
>>>>
>>>> On Mon, Dec 8, 2008 at 11:24 AM, Nino Saturnino Martinez Vazquez Wael <
>>>> nino.martinez at jayway.dk> wrote:
>>>>
>>>>> How can I extract all points for a geometry?
>>>>>
>>>>>
>>>>> http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Geometry/Collection-js.html#OpenLayers.Geometry.Collection
>>>>> , do I need to call a field directly?
>>>>>
>>>>>
>>>>> --
>>>>> -Wicket for love
>>>>>
>>>>> Nino Martinez Wael
>>>>> Java Specialist @ Jayway DK
>>>>> http://www.jayway.dk
>>>>> +45 2936 7684
>>>>>
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at openlayers.org
>>>>> http://openlayers.org/mailman/listinfo/users
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Dr. Adorian Ardelean
>>>> coordinator of myNature Project
>>>>
>>>> http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
>>>> biodiversity-database]
>>>> http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
>>>>
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at openlayers.org
>>>> http://openlayers.org/mailman/listinfo/users
>>>>
>>>>
>>>
>>
>>
>> --
>> Dr. Adorian Ardelean
>> coordinator of myNature Project
>>
>> http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
>> biodiversity-database]
>> http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
>>
>
>


-- 
Dr. Adorian Ardelean
coordinator of myNature Project

http://mybiosis.info/nature/portal.php?pagename=firstpage [a Romanian
biodiversity-database]
http://mybiosis.info/nature/portal.php?pagename=adorian [CV]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20081208/b8858d9b/attachment.html


More information about the Users mailing list