[OpenLayers-Users] Display WFS-Points as markers

Arnd Wippermann arnd.wippermann at web.de
Tue Aug 5 10:54:10 PDT 2014


Hi Andy,

like the example shows.

Add a SelectFeature Control to your map and activate it.

// control that will show a popup when clicking on a feature
var popupControl = new OpenLayers.Control.SelectFeature(markerLayer, {
  onSelect: function(feature) {
      var pos = feature.geometry;
      if (popup) {
          map.removePopup(popup);
      }
      popup = new OpenLayers.Popup("popup",
          new OpenLayers.LonLat(pos.x, pos.y),
          new OpenLayers.Size(254,320),
          "<h3>" + feature.attributes.title + "</h3>" +
          feature.attributes.description,
          true);
      map.addPopup(popup);
  }
}); 
map.addControl(popupControl);

popupControl.activate();

another example
http://harrywood.co.uk/maps/examples/openlayers/marker-popups.html

Regards,
Arnd
 

-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von sulu
Gesendet: Dienstag, 5. August 2014 15:46
An: openlayers-users at lists.osgeo.org
Betreff: Re: [OpenLayers-Users] Display WFS-Points as markers

Thanks Arnd!

Works great!

Now. How to put popups at the locations given by the coordinates of WFS
(points) ?

There is an OL-Example georss-flickr.html which does pretty much what i
would like to do.


Cheers
Andy



--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Display-WFS-Points-as-markers-tp5154974p
5155124.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


---
Diese E-Mail ist frei von Viren und Malware, denn der avast! Antivirus Schutz ist aktiv.
http://www.avast.com



More information about the Users mailing list