[mapserver-users] queryByRect throws an error

Tamas Szekeres szekerest at gmail.com
Wed Jan 7 18:10:59 EST 2009


Hi Murty,

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.

Best regards,

Tamas



2009/1/7 Murty Maganti <MMaganti at oriongis.com>

>  Hi Tamas
>
>
>
> Thanks for reply.
>
>
>
> These are extracts from my code to replicate the issue
>
>
>
> //Create map object
>
> mapObj map = new mapObj("MyMap.map");
>
>
>
> //draw map
>
> map.draw() ;
>
>
>
> //Make sure some template name is defined. Otherwise, query will not be
> successful.
>
>             for (int i = 0; i < map.numlayers; i++)
>
>             {
>
>                 if (string.IsNullOrEmpty(m_map.getLayer(i).template))
>
>                 {
>
>                     m_map.getLayer(i).template = "abc";
>
>                 }
>
>             }
>
>
>
> //Perform the query now
>
> map.queryByRect(map.extents);
>
>
>
>
>
> 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.
>
>
>
> I think the scalebar layer is not satisfying these two conditions in
> msQueryByRect method of mapquery.c and hence getting used for query
>
>
>
>     if(!msIsLayerQueryable(lp)) continue;
>
>     if(lp->status == MS_OFF) continue;
>
>
>
>
>
> Please let me know if you need more info or you need any test application.
>
>
>
>
>
> Thanks
>
> Murty
>
>
>
> *From:* Tamas Szekeres [mailto:szekerest at gmail.com]
> *Sent:* Tuesday, January 06, 2009 3:33 PM
> *To:* Murty Maganti
> *Cc:* mapserver-users at lists.osgeo.org
> *Subject:* Re: [mapserver-users] queryByRect throws an error
>
>
>
> Hi,
>
> 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.
>
> Best regards,
>
> Tamas
>
>
>  2009/1/6 Murty Maganti <MMaganti at oriongis.com>
>
> mapObj.queryByRect(…)  (using C# map script) is throwing following
> exception when there is an embedded scale bar on map.
>
>
>
> Exception message: "msShapefileOpen(): Unable to access file. No (NULL)
> filename provided.;msBuildPath: Unable to access file"
>
>
>
> Removing the scale bar from map file works fine.
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20090108/cb9fa907/attachment.html


More information about the mapserver-users mailing list