[ka-Map-users] Adding objects to Map

Paul Spencer pspencer at dmsolutions.ca
Wed Apr 19 07:28:09 EDT 2006


Hi,

the essential steps in added a POI overlay marker are:

var canvas = null;

function addOverlay( x, y ) {
     if (!canvas) {
         canvas = myKaMap.createDrawingCanvas(1000);
     }
     var img = document.createElement('img');
     img.width = 15; //or whatever size you want
     img.height = 15; //or whatever size you want
     img.src = 'images/myoverlay.png'; //or whatever image you want
     myKaMap.addObjectGeo(canvas,x,y,img);
}

img can be any DOM element (like a div that contains images for  
instance)

It can have two additional attributes that specify the 'hotspot' of  
the image:

img.xOffset = -15;
img.yOffset = -15;

By default, the top left corner is positioned over the geographic  
location (i.e. both xOffset and yOffset are 0).  If you set them to  
negative numbers, it will move the image over the geographic location  
so that a different part of the image is the hotspot.  This example  
positions the bottom right corner.   The values you choose depend on  
the size of your image and the actual image itself.

Cheers

Paul

On 19-Apr-06, at 12:14 AM, G Casey wrote:

> Is anyone adding overlay objects from a postgis database. I would like
> to add POI markers to a map and have tooltips associated with those. I
> can pull out the data fine with php however I have no js skills.  I
> think using the overlay functions is probably the right answer however
> any help would be most appreciated.
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+






More information about the ka-Map-users mailing list