How to use queryByShape

Steve Lime Steve.Lime at DNR.STATE.MN.US
Wed Jun 20 08:29:47 PDT 2007


There is no lame question... ;-)

Things to check:

  - first, is the layer being queried queryable? That is, does it have a TEMPLATE set?

  - are there any possible projection issues? Search shape in a different coordinate system than the points...
  - does the search shape have a bounding box? Depending on how you built it there's a chance it may not and the bbox is used to initially select candidate shapes before the more expensive intersection computations are done. There is a method to rebuild the bbox if necessary (name escapes me though).

Steve

>>> On 6/20/2007 at 9:35 AM, in message
<c52191e30706200735v278e8355s8d41fe2f47496b0b at mail.gmail.com>, Nico Alberti
<nico at LANGHIRANO.IT> wrote:
> Hi everybody. I am quite new to php_mapscript, so excuse me if the
> question is lame.
> 
> I am trying to select which points of a shape are inside a particular
> area, (a  shape from a polygon shapefile), so I do something like
> this, after having instantiated the objects:
> 
> $map->prepareQuery();
> $ret=$layerPoints->queryByShape($ShapeAreaObject);
> 
> However, even if I am sure that some points fall within the area of
> $ShapeAreaObject, nothing is selected. It seems I am missing
> something, but after having read the documentation and the list, I did
> not find any clue. Using the php_ogr extension, the points that fall
> within the area (or better its envelope) are correctly selected, but,
> again, it is certainly my fault, as it's the first time I use this
> library.
> 
> Any help will be greatly appreciated, thank you in afvance



More information about the MapServer-users mailing list