[ka-Map-users] example implementation of XMLoverlay [solved]

Dylan Beaudette dylan.beaudette at gmail.com
Tue Feb 20 18:09:22 EST 2007


On Tuesday 20 February 2007 11:30, Dylan Beaudette wrote:
> Hi everyone,
>
> does there exist a simple example of just how one could go about adding a
> point feature overlay to a ka-map application? I have looked over the wiki
> but the XMLoverlay page is a little unclear.
>
> Essentially, I would like to add a red dot overlay when ever the ka-map
> application is launched with cps args in the URL.
>
> thanks for any insight!
>
> cheers,


Well... after reading up on the wiki, and trying it out for myself it was not 
so hard to implement. Here is how I did it. in the startUp.js file , in the 
OnLoad() function near the bottom I added:

// extract the zoom-to x and y values from the cps args:
var coords = szCPS.split(',') ;
	
// 	setup framework
// 
http://ka-map.ominiverdi.org/wiki/index.php/Overlay_API_Reference#Overlay_objects_attributes
myXmlOverlay = new kaXmlOverlay( myKaMap, 250 );
var my_point = myXmlOverlay.addNewPoint('User Point', coords[0], coords[1]);
	
// 	create the symbol
var my_symbol = new kaXmlSymbol();
my_symbol.shape = 'square';
my_symbol.size = 10;
my_symbol.stroke = 2;
my_symbol.color = '#ff0000';
my_symbol.bcolor = '#ffffff';
my_point.addGraphic(my_symbol);
	
// 	label the symbol
var my_label = new kaXmlLabel();
my_label.text = 'User Point';
my_label.color = '#ffffff';
my_label.h = 11;
my_point.addGraphic(my_label);

worked!

cheers,

-- 
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341


More information about the ka-Map-users mailing list