[ka-Map-users] Polylines?

Paul Spencer pspencer at dmsolutions.ca
Tue Aug 30 09:55:22 EDT 2005


Hi Ben,

cvs ka-Map has some support for the notion of canvases that can be used 
to pin things on the map.

var myCanvas = myKaMap.createDrawingCanvas( 1000 );

where the parameter is the z-Index of the canvas (so you can stack them 
if necessary)

The drawing canvas is used with myKaMap.addObjectGeo:

myKaMap.addObjectGeo( myCanvas, lon, lat, domObj );

which will place an object at a specific geographic location.

lon/lat are the geographic coordinates (dependent on projection obviously)

domObj is any suitable HTML element, usually an IMG or DIV.  For instance:

var domObj = document.createElement( 'img' );
domObj.src = 'images/myMarker.png';
domObj.width = 18;
domObj.height = 18;

By default, the image is pinned with the top/left corner of the image on 
the geographic location.  You can ask it to be offset by some number of 
pixels using xOffset and yOffset attributes on the domObj, for instance:

domObj.xOffset = -9;
domObj.yOffset = -18;

this would shift the image 9 pixels left and 18 pixels up for use with a 
google style marker (where the hotspot is the bottom center).

CAVEAT: I may have the sign wrong on one or both of those, please test 
to make sure it is doing the right thing!

For drawing lines, I have experimented with two different options.  The 
first was using wz_jsgraphics (which is included in the ka-map cvs), see 
www.walterzorn.com.  The second was using server-side generated images.

The server-side generated images should perform slightly better until 
they get large.  I would recommend that you divide long lines up into 
segments of images no larger than your typical tile size (300x300) ... 
in practice, you can make them bigger but at some point, IE gets 
completely hosed by large images.

As a side note, I think Google uses vrml in IE because of this problem.

In either approach, you can use the drawing canvas to actually place the 
image/jsgraphics in and they will move dynamically with the map.

If you get something working that you would like to contribute, please 
let me know.

<sidenote>

Also, have you done anything with prototype for ka-Map yet?  I'm very 
interested in using that as the basis for ka-Map but when I looked at 
the code, I was a bit dubious ... there's not a lot of documentation!

I'm not sure how behaviour would fit, although I do like the concept. 
If you have a proposal on either, I would be happy to entertain it.

</sidenote>

Cheers

Paul

Ben Nolan wrote:
> Hi guys,
> 
> Anyone had any luck doing something like google polylines over ka-maps? 
> I was thinking of drawing transparent gifs with GD then overlaying a big 
> image over the tiles?
> 
> Also - I have implemented my own 'glass layer' that I can add marker 
> points to (ala google thumbtacks) - does the new cvs ka-maps have built 
> in support for this?
> 
> Regards,
> Ben Nolan
> _______________________________________________
> 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