<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=utf-8">
<META content="MSHTML 6.00.6000.16640" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT size=2>Hi</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>after the map modification, you could try
$msMapObj->save('/tmp/exportmap.map'); and see if the modifications you have
done are correctly outputed and look ok.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>Even if the layer doesnt appear in the layer tree, it should
be displayed on map.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>
<DIV><FONT size=2>I noticed the layer type may not be set correctly by
mapoverlay, try doing it with mapscript (see below)</FONT></DIV></FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I just had a try with inserting a non-existing postgis layer
into a mapfile using mapoverlay ( and a bit of mapscript because some properties
are not supported by mapoverlay) and my layer was displayed correctly on
map.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I copy that exemple here, maybe it helps:</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>$color = new ColorOverlay();<BR>$color->red =
255;<BR>$color->green = 0;<BR>$color->blue =
0;<BR> <BR>$style = new
StyleOverlay();<BR>$style->action =
BasicOverlay::ACTION_INSERT;<BR>$style->color = $color;<BR>$style->size =
5;<BR>$style->symbol = "circle";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$class = new ClassOverlay();<BR>$class->action =
BasicOverlay::ACTION_INSERT;<BR>$class->name = 'foobar';<BR>$class->styles
= array($style);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$layer = new LayerOverlay();<BR>$layer->name =
"routing";<BR>//$layer->connectiontype = "postgis";<BR>$layer->connection
= "user=xxx password=yyy host=localhost dbname=zzz";<BR>$layer->data =
"the_geom FROM (SELECT id, the_geom FROM public.result WHERE id = '" .
$requ->id . "') AS foo USING UNIQUE id USING SRID=21781";</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$layer->classes = array($class);<BR>//$layer->type =
"LINE";<BR>$layer->action = BasicOverlay::ACTION_INSERT;</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$mapOverlay =
$this->serverContext->getPluginManager()->mapOverlay;<BR>$mapOverlay->updateMap($layer);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$msMapObj =
$this->getServerContext()->getMapObj();<BR>$msLayer =
$msMapObj->getLayerByName('routing');<BR>$msLayer->set('connectiontype',
MS_POSTGIS);<BR>$msLayer->set('type', MS_LAYER_LINE);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>if (!$msLayer)<BR>throw new CartoserverException("Routing
results layer " .<BR> "$routingResultsLayer not
found");<BR>$msLayer->set('status', MS_ON);</FONT></DIV>
<DIV> </DIV>
<DIV><FONT size=2>$msMapObj->save('/tmp/exportmap.map');</FONT></DIV>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
<DIV
style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B>
<A title=nozimica@gmail.com href="mailto:nozimica@gmail.com">Nicolás Eugenio
Ozimiça</A> </DIV>
<DIV style="FONT: 10pt arial"><B>To:</B> <A
title=oliver.christen@camptocamp.com
href="mailto:oliver.christen@camptocamp.com">Oliver Christen</A> </DIV>
<DIV style="FONT: 10pt arial"><B>Cc:</B> <A
title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org">cartoweb-users@lists.maptools.org</A>
</DIV>
<DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, July 23, 2008 12:57
AM</DIV>
<DIV style="FONT: 10pt arial"><B>Subject:</B> Re: [Cartoweb-users] Problem
creating new layers</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>I've tried what you told me Oliver, but with no
success.<BR><BR>With the lines you gave:<BR>$msLayer =
$this->serverContext->getMapObj()->getLayer($result->layers[0]->index);<BR>$msLayer->set('status',
MS_ON);<BR><BR>I also included these other lines:<BR>$msLayer->set('type',
MS_LAYER_RASTER);<BR>$msLayer->setProcessing("BANDS=1,2,3");<BR><BR>because
the layer I try to create is a raster image.<BR><BR>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.<BR><BR>I'm using ajax, but I made a test without it,
and no result either...<BR><BR>Has someone else had trouble tring to create a
raster layer with MapOverlay?<BR><BR><BR>
<DIV class=gmail_quote>On Fri, Jul 18, 2008 at 2:42 AM, Oliver Christen <<A
href="mailto:oliver.christen@camptocamp.com">oliver.christen@camptocamp.com</A>>
wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT size=2>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.</FONT></DIV>
<DIV><FONT size=2>Layers in the layer tree can only be selected/unselected
if they already exist in your layers.ini, as far as I know.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>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();</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>I have never do that myself but I presume it should be
possible.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV><FONT color=#888888></FONT>
<BLOCKQUOTE dir=ltr
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV class=Ih2E3d>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228); FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=nozimica@gmail.com href="mailto:nozimica@gmail.com"
target=_blank>Nicolás Eugenio Ozimiça</A> </DIV></DIV>
<DIV>
<DIV></DIV>
<DIV class=Wj3C7c>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B>
<A title=oliver.christen@camptocamp.com
href="mailto:oliver.christen@camptocamp.com" target=_blank>Oliver
Christen</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Cc:</B>
<A title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org"
target=_blank>cartoweb-users@lists.maptools.org</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Thursday, July 17, 2008 4:42 PM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B>
Re: [Cartoweb-users] Problem creating new layers</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>You're right! <BR><BR>Here is the code that tries to make
visible a new layer (simulacionesGrupo):<BR><BR> public
function filterPostRequest(FilterRequestModifier $request)
{<BR> $layerList =
$request->getValue('layers');<BR>
$layerList[] =
'simulacionesGrupo';<BR>
$request->setValue('layers', $layerList);
<BR> $this->tempinfo =
implode('--', $layerList);<BR> } <BR><BR>it is in the
Client part of a plugin that implements FilterProvider.<BR><BR>To create
the layer:<BR><BR> function initializeRequest($requ)
{<BR> if ($requ)
{<BR>
$pluginManager =
$this->serverContext->getPluginManager();<BR><BR>
if
(empty($pluginManager->mapOverlay))<BR>
throw new CartoserverException("mapOverlay plugin not loaded,
");<BR><BR>
$mapOverlay =
$pluginManager->mapOverlay;<BR>
$layer = new
LayerOverlay();<BR>
$layer->name =
"simulacionesGrupo";<BR>
$layer->action =
BasicOverlay::ACTION_INSERT;<BR>
$layer->data =
"raster/ozono.99.tif";<BR>
$result =
$mapOverlay->updateMap($layer);<BR>
}<BR> }<BR><BR>it is in the Server part of the same
plugin that extends ClientResponderAdapter.<BR><BR>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':<BR>;
mapInfo.initialMapStates.default.layers.simulacionesGrupo.selected =
true<BR><BR>it doesn't show up in the main map.<BR><BR><BR><BR>
<DIV class=gmail_quote>On Thu, Jul 17, 2008 at 10:25 AM, Oliver Christen
<<A href="mailto:oliver.christen@camptocamp.com"
target=_blank>oliver.christen@camptocamp.com</A>> wrote:<BR>
<BLOCKQUOTE class=gmail_quote
style="PADDING-LEFT: 1ex; MARGIN: 0pt 0pt 0pt 0.8ex; BORDER-LEFT: rgb(204,204,204) 1px solid">
<DIV bgcolor="#ffffff">
<DIV><FONT size=2>Hi</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>without looking at your code, I cant really know what
may or may not happens.</FONT></DIV>
<DIV><FONT size=2></FONT> </DIV>
<DIV><FONT size=2>regards</FONT></DIV>
<DIV><FONT size=2>Oliver</FONT></DIV>
<BLOCKQUOTE
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(0,0,0) 2px solid; MARGIN-RIGHT: 0px">
<DIV>
<DIV></DIV>
<DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal">-----
Original Message ----- </DIV>
<DIV
style="BACKGROUND: rgb(228,228,228); FONT: 10pt arial; font-size-adjust: none; font-stretch: normal; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial"><B>From:</B>
<A title=nozimica@gmail.com href="mailto:nozimica@gmail.com"
target=_blank>Nicolás Eugenio Ozimiça</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>To:</B>
<A title=cartoweb-users@lists.maptools.org
href="mailto:cartoweb-users@lists.maptools.org"
target=_blank>cartoweb-users@lists.maptools.org</A> </DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Sent:</B>
Thursday, July 17, 2008 4:16 PM</DIV>
<DIV
style="FONT: 10pt arial; font-size-adjust: none; font-stretch: normal"><B>Subject:</B>
[Cartoweb-users] Problem creating new layers</DIV>
<DIV><BR></DIV>
<DIV dir=ltr>Hi all!<BR><BR>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.<BR><BR>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...<BR><BR>I hope someone could help!<BR>Thanks
in advance!<BR clear=all><BR>-- <BR>Nicolás Eugenio
Ozimiça<BR>Universidad de Chile </DIV></DIV></DIV>
<P></P>
<HR>
<P></P>_______________________________________________<BR>Cartoweb-users
mailing list<BR><A href="mailto:Cartoweb-users@lists.maptools.org"
target=_blank>Cartoweb-users@lists.maptools.org</A><BR><A
href="http://lists.maptools.org/mailman/listinfo/cartoweb-users"
target=_blank>http://lists.maptools.org/mailman/listinfo/cartoweb-users</A><BR></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Nicolás Eugenio Ozimiça<BR>Universidad de Chile
</DIV></DIV></DIV></BLOCKQUOTE></DIV></BLOCKQUOTE></DIV><BR><BR
clear=all><BR>-- <BR>Nicolás Eugenio Ozimiça<BR>Universidad de Chile
</DIV></BLOCKQUOTE></BODY></HTML>