[ka-Map-users] initialize to a certain position

Paul Spencer pspencer at dmsolutions.ca
Wed Sep 28 08:44:01 EDT 2005


Herman,

I don't have easy access to IE to test ka-map on a daily basis, so it  
is likely that some stuff is a bit broken (since my major changes  
yesterday).  If any of the regulars can diagnose it, that would be  
most helpful :)

To initialize kamap to a certain position and zoom level, you can use  
the kaMap.initialize function and pass the center point and scale as  
the third argument:

myKaMap.initialize( null, null, lon+","+lat+","+scale );

to add a marker at that location, you will need to wait until after  
the map is initialized.  As this happens asynchronously, you will  
need to do something like the following:

var myKaMap, myCanvas;

function myOnLoad()
{
     ...
     myKaMap.registerForEvent( KAMAP_MAP_INITIALIZED, null,  
myMapInitialized );
     ...
}

function myMapInitialized()
{
     myCanvas = myKaMap.createDrawingCanvas( 500 );

     var marker = document.createElement( 'img' );
     marker.src = 'images/marker.png';

     myKaMap.addObjectGeo( myCanvas, lon, lat, marker );
}

Cheers

Paul

On 28-Sep-05, at 1:45 AM, Herman Teo wrote:

> Dear ka-map users,
>
> 1) Is there a way to initialize kamap to a certain position at a  
> certain zoom
> level?
>
> 2) Simultaneously I would like to add a marker at that point.
>
> How do I write the code and where should I place them for the above  
> functions? I
> couldn't find a useful help as I skim through the discussion threads.
>
> Did anyone experience any trouble with IE using the new ka-map CVS  
> version? It
> worked using firefox but IE didn't respond to it.
>
> Thanks a lot.
>
>
> Herman
>
> _______________________________________________
> 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