[mapserver-users] Query Point

Puneet Kishor pkishor at GeoAnalytics.com
Tue Aug 21 12:09:33 EDT 2001


Andrew (and others, to whom this may apply),

On Tuesday, August 21, 2001, at 08:03  AM, ANDREW WOOLEY wrote:

> Folks,
>
> I am really stumped here. I am trying to get my query to work 
> properly.  I am using the nightly build of PHP/Mapscript that I grabbed 
> this morning (August 21, 2001).

my first suggestion right off the bat would be to stop using the nightly 
builds for production purposes. Get a stable copy and stick to it until 
a new stable version is released. That way you are not dealing with any 
of the development level problems that may arise in an interim version.

That said, here are some specifics to your problem --

> I am using a modified-for-my-application version of the gmap demo and 
> when I click on a feature on the map, I get the proper data results, 
> but am the shape is not highlighting and the map zooms to the initial 
> extent.  If anyone has any clues as to why this might be happening and 
> would like to share them with me, I would really appreciate it.
>

First, you have to get the extent of the shape that you are trying to 
highlight. You do that by identifying the row id of the shape in the 
dbase file... remember, the shapes are indexed starting from 0 while the 
dbase file is indexed starting from 2... the first row is the header row.

Then you use the ms_newShapefileObj to read the shape file, and use the 
getExtent method to get the rect of the shape. getExtent requires the 
shape index i (getExtent(int i)) which you get from the row id in the 
dbase file above.

Once you know the mapextent, you can zoom to it. However, you still need 
to highlight your shape.

The easiest way I know is to create highlight layer, set its status to 
off, make it the highlight color you want, and use an expression in the 
class item directive. Once you have chosen your shape above, set the 
status of this highlight layer to on and pass it the value to be 
evaluated in the expression. Your shape will light up.

Hth,

pk/

--
Puneet Kishor
pkishor at eidesis.org



More information about the mapserver-users mailing list