[ka-Map-users] Scale and Centred Question

Paul Spencer pspencer at dmsolutions.ca
Thu Nov 3 09:27:50 EST 2005


Hi Jorden,

an undocumented feature (actually, who am I kidding ... all features  
are undocumented) of the initialize method of the kaMap object is to  
pass additional arguments to specify either extents or center point  
and scale as follows:

var km = new kaMap( 'viewport' );
km.initialize( mapName, extents, centerAndScale );

where all arguments are optional.  If you want to specify a  
particular argument, you must also provide all preceding arguments.   
If you don't want to actually specify a real value for a preceding  
argument, then pass an empty string or null.

For instance,
//specify a particular map
km.initialize( 'map1' );
//use default map but custom extents
km.initialize( '', extents );
//use default map but custom center and scale
km.initialize( '', '', centerAndScale );
//use specific map but custom center and scale
km.initialize( 'map1', '', centerAndScale );

mapName is a string that corresponds to a map name in config.php

extents is an array of [minx, miny, maxx, maxy] or a comma separated  
string

centerAndScale is an array of [cX, cY, scale] or a comma separated  
string

Some examples:

var extents = [minx, miny, maxx, maxy];
km.initialize( '', extents );

var extents = minx + "," + miny + "," + maxx + "," + maxy;
km.initialize( '', extents );

Hope that helps

Paul

On 3-Nov-05, at 6:03 AM, Jorden Dunne wrote:

> Is it possible for kaMap to be loaded to be scaled to a particluar
> level and to be centered on a certain point (x/ycoord) after variables
> being passed to it?
>
> _______________________________________________
> 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