[mapserver-users] Problem with postgis querybypoint in mapserver-php

Guillermo Tamburini Beliveau guitambe at topo.upv.es
Fri Jun 11 05:52:37 EDT 2010


Hi,

I'm trying to recover the line of an ancient subject that I wrote to the list!
It is about a problem with the querybypoint method in php in mapserver with
postgis layers. If you want to see it, please take a look below (previous
message).
I unsubscribed the list because my main reason was to get a response to my
doubt, and nobody response me. But now, browsing the net, I've seen that a user
responded!
Please if you have more information about my problem, reply me because I haven't
resolved it yet.

And please, excuse me for using your user name in the subject, I couldn't send
you an e-mail.

Previous message -----------------------------------------------------------

Hi,

I would like to know if some body knows the reason of a strange problem that I'm
having with the php-mapscript methods for the query methods in the postgis
layers.

Indistinctly for querybypoint or querbyrectangle, my code (different versions of
it), works perfectly with shapes, but it always fails with the postgis layers.
When calling to the shapeindex member of the ResultCacheMemberObj obtained, it
always returns 0, as is contrary to what happends with the shapes, where it
always returns the correct shapeindex.

    Then it is impossible to acces to the desidered feature.

    May I have to add more columns to the select of the .map file for getting
the
    features atributes like in the example (I don't think so)?

        DATA "geom FROM puntos using unique gid"
    #    DATA "geom FROM (select gid , nombre, tramo, geom from puntos) as foo
using
    unique geom"
    #    DATA "geom FROM (select * from puntos) as foo using unique gid"

    Or there is some paramter in the configuration files of mapserver or php
that I
    have to change.

    There is the code of the function:

    function CercaPunto($point,$map,$radius) {

          $qlayer = $map->getLayerByName('trazado');
         $qlayer->set("tolerance",$radius);
         @$qlayer->queryByPoint($point, MS_MULTIPLE, $radius);
         $numResults = $qlayer->getNumResults();
         if ($numResults != 0) {
              for ($i = 0; $i < $numResults; $i++) {
                  $query_result = $qlayer->getResult($i);
                   $Lista_ele[$i] = $query_result->shapeindex; // Here is the
error
    with postgres
              }
         } else {
              $valido =0;
              $Lista_ele = "";
         }
         return $Lista_ele;
    } // end CercaPunto


    Thank you very much.


More information about the mapserver-users mailing list