[OpenLayers-Users] Add popup to GML with marker!

Walter Lorenzetti lorenzetti at faunalia.it
Mon Dec 10 10:10:43 EST 2007


Christopher Schmidt ha scritto:
> On Mon, Dec 10, 2007 at 12:28:51PM +0100, Walter Lorenzetti wrote:
>   
>> Hi everybody,
>>
>> I've a problem with a GML layer:
>> I add to my map a new GML layer and for to put a icon istead the normal
>> vectorial circle
>> I extend default vector layer style:
>>
>>  var style_mark = OpenLayers.Util.extend({},
>> OpenLayers.Feature.Vector.style['default']);
>>      style_mark.graphicWidth = 16;
>>      style_mark.graphicHeight = 16;
>>      style_mark.graphicOpacity = 1;
>>      style_mark.externalGraphic = "/webgis/openlayers/stable/icon.png";
>>
>> Now I've to add I popup to this mark but I don't know I can...
>> Is possible to do that or is necessary parser the GML file and put n
>> markers with popup?
>>     
>
> Looking at http://openlayers.org/dev/doc/examples.html, we see:
>
> 61
> Open Popup on Layer.Vector
> select-feature-openpopup.html
> Using a Control.SelectFeature, open a popup on click. 
>
> http://openlayers.org/dev/examples/select-feature-openpopup.html
>
> Regards,
>   
Thank you Christopher,

now "onSelect" works fine:

 var control =  new OpenLayers.Control.SelectFeature(gml,
                {onSelect: function(feature){
                    OpenLayers.Console.log(feature.attributes.company);
                }
                });

map.addControl(control);
control.activate();

but sorry is possible to do that for "onClick" event?
on class documentation I found only Control.SelectFeature,
.DrawFeature... etc.. but not ClickFeature...

So for you is possible to do that with events.register function?
I try it but my problem is to take the attributes of gml feature:

gml.events.register('click',this,function(){
OpenLayers.Console.log(this); })
           
thank you

Walter

-- 
Please no  .doc, .xls, .ppt, .dwg:
https://www.faunalia.it/dokuwiki/doku.php?id=public:OpenFormats

Walter Lorenzetti
email+jabber: lorenzetti at faunalia.it
www.faunalia.it
Cell: (+39) 347-6597931  Tel+Fax: (+39) 0587-213742
Piazza Garibaldi 5 - 56025 Pontedera (PI), Italy

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20071210/1f06d5b4/attachment.html


More information about the Users mailing list