[Mapserver-dev] WMS GetFeatureInfo

Ross Elliott ross.elliott at infoterra-global.com
Mon Sep 27 06:08:30 EDT 2004


OK, just re-read the OGC docs. I'd wrongly assumed the X,Y params in the request were real-world coords rather than pixel coords from the top-left of the BBOX. 

Ross Elliott

-----Original Message-----
From: Daniel Morissette [mailto:dmorissette at dmsolutions.ca]
Sent: 24 September 2004 21:22
To: Ross Elliott
Cc: mapserver-dev at lists.gis.umn.edu
Subject: Re: [Mapserver-dev] WMS GetFeatureInfo


Could you please create a bug with a testcase (mapfile + data) to 
reproduce the problem? We've used GetFeatureInfo a lot before and never 
noticed that problem, so before we apply the patch I would like to 
reproduce the problem, and then have a way to verify that it's gone.

Thanks

Daniel


Ross Elliott wrote:
> In order to get GetFeatureInfo to work with WMS as I'd expect it to I find that I need to make the following changes to mapserver. Now, am I missing something about how it is meant to work? and if not, do my changes make any sense? My changes to msQueryByPoint allow you to pick out when you are in a polygon or on a line and only want one record returned, before this I'd often get the wrong poly sent back. The change to msWMSFeatureInfo is needed to get the right point for the query rather than a point that doesn't ever seem to exist within my BBOX.
> 
> Ross Elliott
> Senior Software Engineer
> Infoterra Ltd
>  
> 
> -----------------------------------------------------------------
> 
> 
> mapwms.c msWMSFeatureInfo
> COMMENT OUT THE FOLLOWING CODE
> 
>   // Perform the actual query
>   //cellx = MS_CELLSIZE(map->extent.minx, map->extent.maxx, map->width); // note: don't adjust extent, WMS assumes incoming extent is correct
>   //celly = MS_CELLSIZE(map->extent.miny, map->extent.maxy, map->height);
>   //point.x = MS_IMAGE2MAP_X(point.x, map->extent.minx, cellx);
>   //point.y = MS_IMAGE2MAP_Y(point.y, map->extent.maxy, celly);
> 
> ------------------------------------------------------------------
> 
> mapquery.c msQueryByPoint()
> CHANGE 
> 
>       d = msDistancePointToShape(&p, &shape);
>       if( d <= t ) { // found one
> 	if(mode == MS_SINGLE) {
> 	  lp->resultcache->numresults = 0;
> 	  addResult(lp->resultcache, shape.classindex, shape.index, shape.tileindex);
> 	  lp->resultcache->bounds = shape.bounds;
> 	  t = d; // next one must be closer
> 	} else {
> 	  addResult(lp->resultcache, shape.classindex, shape.index, shape.tileindex);
> 	  if(lp->resultcache->numresults == 1)
> 	    lp->resultcache->bounds = shape.bounds;
> 	  else
> 	    msMergeRect(&(lp->resultcache->bounds), &shape.bounds);
> 	}
>       }
>  
>       msFreeShape(&shape);	
>     } // next shape
> 
> TO
>       int NoOfHits=0;
>       d=0.0;
>       if(lp->type == MS_LAYER_POLYGON || lp->type == MS_LAYER_LINE)
>         NoOfHits = msIntersectPointPolygon(&p, &shape);
>       else
>         d = msDistancePointToShape(&p, &shape);
> 
>       if(((lp->type == MS_LAYER_LINE || lp->type == MS_LAYER_POLYGON) & NoOfHits && 0x01) || (lp->type != MS_LAYER_POLYGON & d <= t))
>       {
>           if(mode == MS_SINGLE) {
>           lp->resultcache->numresults = 0;
>           addResult(lp->resultcache, shape.classindex, shape.index, shape.tileindex);
>           lp->resultcache->bounds = shape.bounds;
>           t = d; // next one must be closer
>         } else {
>           addResult(lp->resultcache, shape.classindex, shape.index, shape.tileindex);
>           if(lp->resultcache->numresults == 1)
>             lp->resultcache->bounds = shape.bounds;
>           else
>             msMergeRect(&(lp->resultcache->bounds), &shape.bounds);
>         }
>       }
>  
>       msFreeShape(&shape); 
> 
> 
> The information in this e-mail and any attachment is confidential and may be privileged. If you have received this e-mail in error, please delete it immediately and destroy any copies on your system. You should not retain, copy or use this e-mail for any purpose, nor disclose all or any part of its content to any other person.
> Opinions expressed in this e-mail may not be endorsed by the company and unless explicitly indicated, this e-mail shall not form part of any binding agreement.
> 
> 
> _______________________________________________
> Mapserver-dev mailing list
> Mapserver-dev at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-dev
> 





More information about the mapserver-dev mailing list