Hi Murty,<br><br>Yes, you&#39;re correct. By setting the template parameter of these internal layers like __embed__legend or __embed__scalebar causes the behaviour you&#39;ve reported before. However I&#39;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&#39;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">&lt;<a href="mailto:MMaganti@oriongis.com">MMaganti@oriongis.com</a>&gt;</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);">&nbsp;</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);">&nbsp;</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);">&nbsp;</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);">&nbsp;</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);">&nbsp;</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);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
for (int i = 0; i &lt; map.numlayers; i++)</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (string.IsNullOrEmpty(m_map.getLayer(i).template))</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
m_map.getLayer(i).template = &quot;abc&quot;;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</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);">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</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);">&nbsp;</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);">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp;&nbsp; if(!msIsLayerQueryable(lp)) continue;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;&nbsp; &nbsp;if(lp-&gt;status == MS_OFF) continue;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</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);">&nbsp;</span></p>

<p><span style="font-size: 11pt; color: rgb(31, 73, 125);">&nbsp;</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);">&nbsp;</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>&nbsp;</p>

<p style="margin-bottom: 12pt;">Hi,<br>
<br>
Could you provide a code/mapfile sample to reconstruct the issue? I&#39;ve never
experienced such a problem, I&#39;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 &lt;<a href="mailto:MMaganti@oriongis.com" target="_blank">MMaganti@oriongis.com</a>&gt;</p>

<div>

<div>

<p>mapObj.queryByRect(…) &nbsp;(using C# map script) is throwing
following exception when there is an embedded scale bar on map.</p>

<p>&nbsp;</p>

<p>Exception message: &quot;msShapefileOpen(): Unable to access file. No (NULL)
filename provided.;msBuildPath: Unable to access file&quot;</p>

<p>&nbsp;</p>

<p>Removing the scale bar from map file works fine. </p>

<p>&nbsp;</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>&nbsp;</p>

</div></div></div>

</div>


</blockquote></div><br>