<div>Hi, thank you Julien for the answer finally I put the php code of bug 1068 in the right file... but again it doesn't work for me (In the UpdateMap.php I haven't got 1050 lines but I put the code at line 760 just before the line $_SESSION["gszCurrentState"] = $oMapSession->saveState();).</div>
<div>When I call CWCRunQuery function the map starts "Loading..." but then the loading of the map doesn't complete and doesn't throw any javascript or php error. After a while, if I try to Update, with the update widget, the map doesn't load again but I can see in the legend the new layer for the selection ("<span class="label">StraGISWebSelection"). Anyway to go on I have to restart the application because it is completely blocked with "Loading..." gif in the middle of the map. I tried to put the filter in the map file (FILTER "idobj like 'COD07%'" ) and it works so I don't know why it doesn't work with that function, any idea about this?</span></div>
<div><span class="label"></span> </div>
<div><span class="label">Thank you again for all the help.</span></div>
<div><span class="label">Federica</span><br><br> </div>
<div><span class="gmail_quote">2008/3/28, Julien-Samuel Lacroix <<a href="mailto:jlacroix@mapgears.com">jlacroix@mapgears.com</a>>:</span>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi,<br><br>If you want to use the code in bug 1068, simply add the CWCRunQuery<br>function in the chameleon/htdocs/widgets/js/cwcjsapi.js file and add the<br>
following at the bottom of the same file:<br>CWCApplication.prototype.RunQuery = CWCRunQuery;<br><br>Then add the big if() statement in chameleon/htdocs/UpdateMap.php around<br>line 1050, just before the following line:<br>
$_SESSION["gszCurrentState"] = $oMapSession->saveState();<br><br>This will allow you to apply a filter like this:<br>goCWCJSAPI.RunQuery(layername, "field = value");<br><br>However I'm not sure I'll be able to help you more than that.<br>
<br>If you want to make your existing code work, I tried to add your<br>function in the sample_basic_jsapi.html and it worked with few modification.<br><br>I added this just before the myOnLoad function<br>function testzoom(x,y,x2,y2)<br>
{<br> goCWCJSAPI.oMap.SetExtents(x,y,x2,y2)<br>}<br>function testselect(nX ,nY,nX2 ,nY2)<br>{<br> var queryCoords = nX + "," + nY + ";" + nX2 + "," + nY2;<br> var img = CWCDHTML_GetImage( 'MapLayerDivImg' );<br>
var str_gMap=gMapDHTMLURL .split("&UniqId=");<br> img.src = str_gMap[0] + "&run_query=1&gszQueryCoords=" + queryCoords ;<br> window.status = img.src;<br> goCWCJSAPI.oMap.Refresh();<br>
}<br><br>And this at the very beggining of the <form>:<br><br><br><br><input type="button" name="ttt" value="Test zoom"<br>onclick="testzoom(1718420.8896, 39539.518383, 1884136.658,163826.344683)"><br>
<input type="button" name="ttt" value="Test query"<br>onclick="testselect(279,237,299,257)"><br><br>When I click the "Test select" button it highlight Quebec city and when<br>
I click "Test zoom" it zoom on it and keep it selected.<br><br>Hope that helps<br><br>Julien<br><br>Federica De Martin wrote:<br>> Hi, always me, Federica. Thank you Julien for the fast answer.<br>> The Highlight works fine for me in the query widget, also between zoom.<br>
> My problem is when I make a search with some php code and then I use my<br>> funciton "AddSelection" and try to zoom setting the New Extents with<br>> goCWCJSAPI.oMap.SetExtents(x,y,x2,y2) function. In my opinion the<br>
> features don't highlight because the second function is called before<br>> the first is over, but I don't know how to correct it.<br>> Finally I prefer to make something via php like this one<br>> <a href="http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html">http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html</a> that<br>
> is more sure, but I don't know where to put the php code to make it<br>> work. I also tried to put it in the function ParseUrl (that I have<br>> added) in the Update.widget.php but it doesn't work,<br>> any suggestion?<br>
><br>> Thanks.<br>><br>> Federica<br>><br>> 2008/3/27, Julien-Samuel Lacroix <<a href="mailto:jlacroix@mapgears.com">jlacroix@mapgears.com</a><br>> <mailto:<a href="mailto:jlacroix@mapgears.com">jlacroix@mapgears.com</a>>>:<br>
><br>> Hi,<br>><br>> Do the Chameleon samples work?<br>> If they work, you can try to go in sample_basic.phtml and<br>> sample-basic_jsapi.phtml and add the following parameter to the Query<br>
> widget:<br>> HighlightResults="true"<br>><br>> This should highlight the result of your query and keep it highlighted<br>> between zoom.<br>><br>> Is that what you were looking for?<br>
><br>> Julien<br>><br>> PS: If sample_basic.phtml works and not sample_basic_jsapi.phtml you may<br>> need to install Chameleon 2.6rc1.<br>><br>><br>> Federica De Martin wrote:<br>> ><br>
> > Hi,<br>> > I write again and I hope somebody is going to answer me...<br>> > Now I use this function but it works only with Point layer and if<br>> I try<br>> > to zoom after or before it doesn't work...<br>
> > function addSelection(nX ,nY,nX2 ,nY2){<br>> > var queryCoords = nX + "," + nY + "," + nX2 + "," + nY2;<br>> > var img = CWCDHTML_GetImage( 'MapLayerDivImg' );<br>
> > var str_gMap=gMapDHTMLURL .split("&UniqId=");<br>> > mg.src = str_gMap[0] + "&run_query=1&gszQueryCoords=" +<br>> queryCoords ;<br>> > window.status = img.src;<br>
> > goCWCJSAPI.oMap.Refresh();<br>> > }<br>> ><br>> > I also have tried with this function that create a new layer with a<br>> > point using the existing jsapi function but it doesen't work for me.<br>
> > function AddSel(nX ,nY,szName){<br>> > goCWCJSAPI.oMap.CreateNewLayer("tmp_"+szName, "POINT", 1);<br>> > goCWCJSAPI.RefreshMap();<br>> > // var layer_orig=goCWCJSAPI.oMap.GetLayerByName(szName);<br>
> > var layer_sel=goCWCJSAPI.oMap.GetLayerByName('tmp_'+szName);<br>> > // layer_sel=layer_orig;<br>> > var p=new CWCPoint();<br>> > p.x=nX ;<br>> > p.y=nY;<br>
> > p.symbol=0;<br>> > p.symbol_size=40;<br>> > p.symbol_color="255,0,100";<br>> > p.symbol_outlinecolour = "255,255,255";<br>> > //layer_sel.SetStatus()="ON";<br>
> > goCWCJSAPI.oMap.GetLayerByName('tmp_'+szName).SetStatus("ON");<br>> > layer_sel.SetProjection="epsg:26591";<br>> > layer_sel.Promote();<br>> > goCWCJSAPI.oMap.AddPoint("tmp_"+szName, p);<br>
> > }<br>> ><br>> > I think that the right way to approch to the problem is this<br>><br>> ><br>> <<a href="http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html">http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html</a>><br>
> ><br>> <<a href="http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html">http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html</a>>but<br>> > I am not able to make it work. I wait for some pieces of advice!<br>
> > Tanks Federica.<br>> ><br>> > Hi everybody,<br>> > I'm working on how to highlight elements in map. I need a<br>> function to do<br>> ><br>> > this from a popup and from the same form of the map. I find out this<br>
> ><br>> <a href="http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html">http://lists.maptools.org/pipermail/chameleon-dev/2005-May/003973.html</a><br>> but<br>> ><br>> > I'm not able to make it work.<br>
> > I don't know where to put the php code, I also tried to use ajax<br>> but I get<br>> > an error in php file on the final istruction:<br>> ><br>> > $_SESSION["gszCurrentState"] = $oMapSession->saveState();<br>
> ><br>> > ... saveState() on a non-object ...<br>> ><br>> > maybe because I don't include or call any other chameleon file<br>> (but if I try<br>> > I get many errors... maybe I include the wrong files...).<br>
> > Can you help me to make that example work or can you give me an<br>> idea on how<br>> ><br>> > to proceed to solve this problem?<br>> ><br>> > Thank you,<br>
> > Federica<br>> ><br>> ><br>><br>> ><br>> ------------------------------------------------------------------------<br>> ><br>> > _______________________________________________<br>
> > Chameleon mailing list<br>> > <a href="mailto:Chameleon@lists.maptools.org">Chameleon@lists.maptools.org</a> <mailto:<a href="mailto:Chameleon@lists.maptools.org">Chameleon@lists.maptools.org</a>><br>
> > <a href="http://lists.maptools.org/mailman/listinfo/chameleon">http://lists.maptools.org/mailman/listinfo/chameleon</a><br>><br>><br>> --<br>> Julien-Samuel Lacroix<br>> Mapgears<br>
> <a href="http://www.mapgears.com/">http://www.mapgears.com/</a><br>><br>><br><br>--<br>Julien-Samuel Lacroix<br>Mapgears<br><a href="http://www.mapgears.com/">http://www.mapgears.com/</a><br></blockquote></div>
<br>