[Cartoweb-users] Problem creating new layers
Nicolás Eugenio Ozimiça
nozimica at gmail.com
Tue Jul 22 18:57:50 EDT 2008
I've tried what you told me Oliver, but with no success.
With the lines you gave:
$msLayer =
$this->serverContext->getMapObj()->getLayer($result->layers[0]->index);
$msLayer->set('status', MS_ON);
I also included these other lines:
$msLayer->set('type', MS_LAYER_RASTER);
$msLayer->setProcessing("BANDS=1,2,3");
because the layer I try to create is a raster image.
The only solution I see is having a set of empty layers in the mapfile (and
also in the layers.ini), hidden from the menu layer tree, that when a user
specifies a raster to be shown, is "put" in the first empty layer available.
But this is something here we don't like very much.
I'm using ajax, but I made a test without it, and no result either...
Has someone else had trouble tring to create a raster layer with MapOverlay?
On Fri, Jul 18, 2008 at 2:42 AM, Oliver Christen <
oliver.christen at camptocamp.com> wrote:
> 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 <nozimica at gmail.com>
> *To:* Oliver Christen <oliver.christen at camptocamp.com>
> *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 <nozimica at gmail.com>
>> *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
>
>
--
Nicolás Eugenio Ozimiça
Universidad de Chile
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/cartoweb-users/attachments/20080722/f23a253f/attachment.html
More information about the Cartoweb-users
mailing list