[mapserver-users] tile index = -1!!!!

Pushkar Pradhan pushkar at ERC.MsState.Edu
Sat Apr 13 14:32:46 PDT 2002


Stephen,
Your explanation helped a lot, now I am able to get the correct georef.
coords. of my map when I click on the image in my browser.
However still I am not getting any query results, I use the func.
GMapDumpQueryResults() from gmap demo. The table appears with the result
fields I specify in my map file, but no results are shown.
In my GMapDumpQueryResults() I o/p some info:
            $oRes = $oLayer->getResult($iRes);
            echo "$oRes->tileindex $oRes->shapeindex";
            $oShape = $oLayer->getShape($oRes->tileindex,$oRes->shapeindex);
this gives me a tile index = -1 every time.
I don't have a tile index defined in my map file, and I don't think it is
necessary since it is not in the gmap demo map file.
What I do in short is as follows:
1. detect query mode
2. convert pixel position to georef. coords.
3. create point obj.:
      $oClickGeo = ms_newPointObj();
      $oClickGeo->setXY($nClickGeoX, $nClickGeoY);
4. queryByPoint:
      @$map->queryByPoint($oClickGeo, MS_SINGLE, -1);
5. dump results
      $gbShowQueryResults = TRUE;
      GMapDumpQueryResults();
Can anyone help me? Thanks,
> Pushkar,
>
> It is very important that you match the aspect ratio of your map extents
> to the aspect ratio of the image. For example on my map at
> http://swoodbridge.com/web2/nmap which has the whole world displayed
> which everyone knows is EXTENT -180 -90 180 90 and my image is 600X600
> so what to we have:
>
> 360         600
> ---  is to  ---  or 2 to 1 this is BAD
> 180         600
>
> the aspect ratio need to match! so I changed my map to
> EXTENT -180 -180 180 180 so
>
> 360         600
> ---  is to  --- or 1 to 1 this is GOOD
> 360         600
>
> This also has implications if you want to allow your user to change the
> size of the image and they don't maintain the aspect ratio match.
>
> There is code in the RectObj in phpmapscript to help manage this. Or you
> can write your own rescaling code like I did before I found the the
> $oRect->fit($width, $hieght) method.
>
> -Steve
>
> Pushkar Pradhan wrote:
> >
> > Hi all,
> > I am trying to query my maps using php/mapscript. I am using the function
> > GMapPix2Geo to convert the mouse coords. clicked to georef. coords.
> > However the conv. coordinates of the locn. clicked is different from those
> > shown in arcview.
> > How do I choose the extent of the map, I searched the archives but didn't
> > find any. Right now I go to arcview and put my mouse on the farthest
> > positions of the shapefile, and write down the values arcview displays on
> > the top right.
> > Thanks,
> >
> > -Pushkar S. Pradhan
>

-Pushkar S. Pradhan




More information about the MapServer-users mailing list