Hi Murty,<br><br>Yes, you're correct. By setting the template parameter of these internal layers like __embed__legend or __embed__scalebar causes the behaviour you've reported before. However I'm not sure it should be denoted as a bug since you could easily skip setting these parameters in your code. Skipping these layers in the mapserver query code may cause slower execution which is undesirable in most cases. I'm guessing there might be some other occurrences where altering these special layers in mapscript may also cause unexpected results.<br>
<br>Best regards,<br><br>Tamas<br><br><br><br><div class="gmail_quote">2009/1/7 Murty Maganti <span dir="ltr"><<a href="mailto:MMaganti@oriongis.com">MMaganti@oriongis.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Hi Tamas</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks for reply.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">These are extracts from my code to replicate the issue</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">//Create map object</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">mapObj map = new mapObj("MyMap.map");</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">//draw map</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">map.draw() ; </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">//Make sure some template name is defined. Otherwise, query will
not be successful.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
for (int i = 0; i < map.numlayers; i++)</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
{</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
if (string.IsNullOrEmpty(m_map.getLayer(i).template))</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
{</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
m_map.getLayer(i).template = "abc";</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
}</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">
}</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">//Perform the query now</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">map.queryByRect(map.extents);</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">I think after a call to map.draw(), a new layer '__embed__scalebar'
is added to layers collection. Setting template name to it is performing the query
on scalebar layer as well. </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">I think the scalebar layer is not satisfying these two
conditions in msQueryByRect method of mapquery.c and hence getting used for
query</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> if(!msIsLayerQueryable(lp)) continue;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> if(lp->status == MS_OFF) continue;</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Please let me know if you need more info or you need any test
application.</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Thanks</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">Murty</span></p>
<p><span style="font-size: 11pt; color: rgb(31, 73, 125);"> </span></p>
<div style="border-style: solid none none; border-color: rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color; border-width: 1pt medium medium; padding: 3pt 0in 0in;">
<p><b><span style="font-size: 10pt;">From:</span></b><span style="font-size: 10pt;"> Tamas Szekeres
[mailto:<a href="mailto:szekerest@gmail.com" target="_blank">szekerest@gmail.com</a>] <br>
<b>Sent:</b> Tuesday, January 06, 2009 3:33 PM<br>
<b>To:</b> Murty Maganti<br>
<b>Cc:</b> <a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<b>Subject:</b> Re: [mapserver-users] queryByRect throws an error</span></p>
</div><div><div></div><div class="Wj3C7c">
<p> </p>
<p style="margin-bottom: 12pt;">Hi,<br>
<br>
Could you provide a code/mapfile sample to reconstruct the issue? I've never
experienced such a problem, I've used this function many times though.<br>
<br>
Best regards,<br>
<br>
Tamas<br>
<br>
<br>
</p>
<div>
<p>2009/1/6 Murty Maganti <<a href="mailto:MMaganti@oriongis.com" target="_blank">MMaganti@oriongis.com</a>></p>
<div>
<div>
<p>mapObj.queryByRect(…) (using C# map script) is throwing
following exception when there is an embedded scale bar on map.</p>
<p> </p>
<p>Exception message: "msShapefileOpen(): Unable to access file. No (NULL)
filename provided.;msBuildPath: Unable to access file"</p>
<p> </p>
<p>Removing the scale bar from map file works fine. </p>
<p> </p>
</div>
</div>
<p style="margin-bottom: 12pt;"><br>
_______________________________________________<br>
mapserver-users mailing list<br>
<a href="mailto:mapserver-users@lists.osgeo.org" target="_blank">mapserver-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/mapserver-users" target="_blank">http://lists.osgeo.org/mailman/listinfo/mapserver-users</a></p>
</div>
<p> </p>
</div></div></div>
</div>
</blockquote></div><br>