[OSM-dev] [Talk-GB] cycling routes

Christopher Schmidt crschmidt at metacarta.com
Thu Aug 16 20:26:14 BST 2007


On Thu, Aug 16, 2007 at 08:17:27PM +0100, Andy Allan wrote:
> On 8/16/07, stanley12 at blueyonder.co.uk <stanley12 at blueyonder.co.uk> wrote:
> > This has just been brough to my attention.
> >
> > http://maps.camdencyclists.org.uk/
> >
> > Had a quick look but nothing too understand it properly. Was wondering if
> > it may be of use to those working on the cycle routes if you werent aware
> > of it already.
> 
> No, I hadn't seen it. Sites like this makes me wish things happen in
> different orders - I hate how much time and effort people have put
> into google maps before we've finished making better ones for them to
> use instead!
> 
> Has anyone any experience of making clicky-icons with our stack
> (openlayers etc)? For instance, if I have a bunch of nodes tagged e.g.
> (don't shoot me for the tagging)
> shop=bike
> name=Evan's Cycles
> url = http://example.com/shopid=5
> openinghours=9am-8pm
> 
> ... and I want to put an icon on the map to click to make a popup -
> how do I do this? Is it possible with openlayers?

Yes.

markers = new OpenLayers.Layer.Markers("zibo");
map.addLayer(markers);

feature = new OpenLayers.Feature(layer, 
                           new OpenLayers.LonLat(0,0));
marker = feature.createMarker();

markers.addMarker(marker);
marker.events.register("mousedown", marker, function(evt) {
     if (popup == null) {
         popup = feature.createPopup(true);
         popup.setContentHTML("<a
href='http://www.somethingconstructive.net' target='_blank'>click
me</a>");
           markers.map.addPopup(popup);
       } else {
           markers.map.removePopup(popup);
           popup.destroy();
           popup = null;
       }
       Event.stop(evt);

});

marker at 0,0 with a popup with a link inside.

(From http://openlayers.org/dev/examples/popups.html )

Next version will probably have popups like:

http://www.ukvoyager.info/pages/map/usermap.aspx

Regards,
-- 
Christopher Schmidt
MetaCarta




More information about the dev mailing list