[Cartoweb-users] Problem creating new layers
Oliver Christen
oliver.christen at camptocamp.com
Fri Jul 18 02:42:31 EDT 2008
By the way, inserting a layer via mapOverlay only create a new layer on the map image, it will not create a new entry in the menu layer tree.
Layers in the layer tree can only be selected/unselected if they already exist in your layers.ini, as far as I know.
You could eventualy use the same mecanism as the ogcLayerLoader and trigger layer insertion via the use of the userLayers variable. See ClientOgcLayerLoader, the parts around $userLayer = new UserLayer();
I have never do that myself but I presume it should be possible.
regards
Oliver
----- Original Message -----
From: Nicolás Eugenio Ozimiça
To: Oliver Christen
Cc: cartoweb-users at lists.maptools.org
Sent: Thursday, July 17, 2008 4:42 PM
Subject: Re: [Cartoweb-users] Problem creating new layers
You're right!
Here is the code that tries to make visible a new layer (simulacionesGrupo):
public function filterPostRequest(FilterRequestModifier $request) {
$layerList = $request->getValue('layers');
$layerList[] = 'simulacionesGrupo';
$request->setValue('layers', $layerList);
$this->tempinfo = implode('--', $layerList);
}
it is in the Client part of a plugin that implements FilterProvider.
To create the layer:
function initializeRequest($requ) {
if ($requ) {
$pluginManager = $this->serverContext->getPluginManager();
if (empty($pluginManager->mapOverlay))
throw new CartoserverException("mapOverlay plugin not loaded, ");
$mapOverlay = $pluginManager->mapOverlay;
$layer = new LayerOverlay();
$layer->name = "simulacionesGrupo";
$layer->action = BasicOverlay::ACTION_INSERT;
$layer->data = "raster/ozono.99.tif";
$result = $mapOverlay->updateMap($layer);
}
}
it is in the Server part of the same plugin that extends ClientResponderAdapter.
Anyway, if the "simulacionesGrupo" layer is defined in the mapfile, and the line with ACTION_INSERT is not used in the last piece of code, and the next line is commented in 'layers.ini':
; mapInfo.initialMapStates.default.layers.simulacionesGrupo.selected = true
it doesn't show up in the main map.
On Thu, Jul 17, 2008 at 10:25 AM, Oliver Christen <oliver.christen at camptocamp.com> wrote:
Hi
without looking at your code, I cant really know what may or may not happens.
regards
Oliver
----- Original Message -----
From: Nicolás Eugenio Ozimiça
To: cartoweb-users at lists.maptools.org
Sent: Thursday, July 17, 2008 4:16 PM
Subject: [Cartoweb-users] Problem creating new layers
Hi all!
I'm using the 'mapOverlay' plugin in order to modify the layers of my project. It has worked well to modify existing layers, but when I try to insert a new one, it simply does nothing.
Perhaps it is related to another problem I'm facing: I can only hide a layer with "FilterProvider". If I try to make visible a layer that is not set as visible by default in the "layers.ini" file, nothing happens...
I hope someone could help!
Thanks in advance!
--
Nicolás Eugenio Ozimiça
Universidad de Chile
--------------------------------------------------------------------------
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users
--
Nicolás Eugenio Ozimiça
Universidad de Chile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20080718/0df43b34/attachment.html
More information about the Cartoweb-users
mailing list