[OpenLayers-Users] Add popup to GML with marker!
Eric Lemoine
eric.c2c at gmail.com
Tue Dec 11 14:30:06 EST 2007
On Dec 10, 2007 4:10 PM, Walter Lorenzetti <lorenzetti at faunalia.it> wrote:
>
> 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?
I don't understand. Using the select feature control you should be
able to select features by clicking on them. Don't you see your
OpenLayers.Console.log message displayed when you click on features?
--
Eric
More information about the Users
mailing list