Query shapes in certain extent

Lowell Filak lfilak at MEDINACO.ORG
Wed Sep 1 09:20:28 EDT 2004


The following message was sent by G-Net Consulting
<joelf at GNETCONSULTING.COM> on Tue, 31 Aug 2004 14:50:11 -0400.

> Hello list:
>
> What is the best way to access the shapes and locations of
> points marked within a given map?  I have several hundred
> points I need to find that are displayed from a given layer.
> What's the best way to accomplish this?
>
> I currently have a layer that has over 5,000 points marked
> through the US.  As they drill down, I plan to use JavaScript
> to display information about each one.  In the dbf file, I have
> an ID that corresponds to an ID in a MySQL table.  I just
> to get the ID"s of just the one displayed inside the chosen
> extent.
>
> I'm using PHP 4.3.3 with MapScript 4.2.1 on Redhat 9.
>
> Thanks in advance.
>
> Joel

Joel;

If you create a rectObj using the specified extent you can use
layer->queryByRect to query the point(s) into the layer resultcache and
then use layer->getResult & resultCacheMemberobj->shapeindex to retrieve
the shapeindex for each of the resulting points.
If your id in the mysql database corresponds to the shapeindex your all
set. If not then you will need to use an xbase module to pull the nth
(shapeindex) record from the dbf file to obtain the id that links to the
id in the mysql table.

Lowell



More information about the mapserver-users mailing list