[ka-Map-users] generating new layer on the fly
Paul Spencer
pspencer at dmsolutions.ca
Fri Jan 5 13:17:06 EST 2007
Sébastien,
you can dynamically add layers at run time by constructing a new
instance of _layer and adding it to the map ... something like:
var opts = {};
//set up opts
//...
var layer = new _layer(opts);
var map = myKaMap.getCurrentMap();
map.addLayer(layer);
The opts variable is a set of options used to build a new layer
within the current map. The variables you can pass are not
documented, but you can see them in the code at around line 2165 in
the _layer function.
This may not accomplish what you want, however. The default setTile
function gets the name of the map file from the map that it is part
of. You could quite easily copy all the _layer related stuff and
create your own layer class that passes a different map name or calls
an entirely different url (see wmsLayer.js for an example).
Cheers
Paul
On 5-Jan-07, at 10:58 AM, Sébastien Roch wrote:
> Hi everybody,
> I’m working on a project using ka-map which would need to load new
> layer,
> but AFTER ka-map has initialized, without reloading the page.
> When the user pans the map and arrive above a city for example, I
> would like
> that a new layer appears. The layer features and content depend of
> user’s
> rights (he makes a login). And I can’t put in the mapfile all the
> possible
> layers for each region, with all the possible rights, etc...
>
> Is there a way to do this with ka-map ?
> I thought about another way to do it : generating the mapfile after
> logging.
> But I wanted to know if the first manner is possible.
> Thanks.
>
> Sébastien
>
>
> _______________________________________________
> 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 |
+-----------------------------------------------------------------+
|Chief Technology Officer |
|DM Solutions Group Inc http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+
More information about the ka-Map-users
mailing list