[Cartoweb-users] Problem creating new layers

Oliver Christen oliver.christen at camptocamp.com
Fri Jul 18 02:12:06 EDT 2008


Hi

maybe try to enable the new layer after $result = $mapOverlay->updateMap($layer); :

$msLayer = $this->serverContext->getMapObj()->getLayer($result->layers[0]->index);
$msLayer->set('status', MS_ON);

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/9873a39c/attachment.html


More information about the Cartoweb-users mailing list