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

Hermawan Sutantio hsutanti at umich.edu
Wed Sep 28 10:14:36 EDT 2005


Dear Paul,

I followed the code snippets to place a marker in the map.
I discovered that the marker changes position as I zoom in/out. It 
doesn't stay
at the right coordinate at large scale. It becomes more accurate in the 
smaller
scale.
Has this been observed by anyone who has tried the same code?
Thanks.


Herman

Quoting Paul Spencer <pspencer at dmsolutions.ca>:

> 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