[ka-Map-users] GeoCoordinates to Pixel position

Wei Yang, Ng - Wayne wayne at datalinktech.com.au
Thu May 11 19:52:02 EDT 2006


Hi Ramesh,
     I am doing similar stuff and I am having the same problem. (The map slides to anywhere else but the point that I want)A possible solution
(not tested) is to create a javascript function that kicks in when the zoom level changes. (a few events trigger a zoom level change eg. mouse scroll, icon click, KB +/-)
The function finds out(a set variable perhaps) if the map is supposed to zoom to a certain geographic coordinate and reinvokes the function(supplying lat/long of course) that moves/slides to it. This idea is based on the observation that while the map is sliding, I am able to interrupt the action by dbl clicking anywhere on the map.

Cheers,
Wayne
> Hi,
>
> I am trying to figure out the correct pixel position
> for a given geo-coordinates in all zoom levels.
>
> I looked at the code, and it looks like the following
> sequence 
>
> p = kaMap.geoToPix(geox,geoy) 
> newxy = kaMap.currentTool.adjustPixPosition(p[0]*-1,
> p[1]*-1)
>
> seem to work fine if the zoom level is not changed but
> only extents are changed.
>
> How do I calculate the correct pixel position when
> zoom level(or scales) change?
>
> Thanks
> Ramesh


More information about the ka-Map-users mailing list