Buffer query

Stefanie Weykam sweykam at TELELINE.ES
Thu Feb 10 04:26:50 EST 2005


Hi list,
I got inspired by Camden Daily's comments on buffer queries. But I can't get
this strait.

I am in a similar situation. I have to have my map in geographic coordinates
as well. But my map covers a too big area, so I ought to reproject my query
point and test layers to a metrical reference system before I do the
queryByPoint at a determined buffer size.

I have a point object and want to find all features within 500 Km distance.
I expect to find 2 features within this radius. Just before the query is
performed, I clone the point and the layer, reproject to UTM and set the
tolerance value of my test layer to 500 and the units to Km.

$projInObj = ms_newprojectionobj("init=epsg:4326");
$projOutObj = ms_newprojectionobj("init=epsg:32632");
$tmp_point = ms_newPointObj();
$tmp_point->setXY($pt->x, $pt->y);             # clone the point
$tmp_point->project($projInObj, $projOutObj);  # change projection of pnt

$currentLayer = $map->getLayerByName("SPAMI");
$tmp_layer = ms_newLayerObj($map, $currentLayer); # clone current layer
$tmp_layer->setProjection("init=epsg:32632");  # change projection of lyr
$tmp_layer->set(toleranceunits, MS_KILOMETERS);
$tmp_layer->set(tolerance, 500);
if (@$tmp_layer->queryByPoint($tmp_pt, MS_MULTIPLE , -1)==MS_SUCCESS)
....
This does not return anything.

Since Camden daily reported the same problem, I tried if I was lucky and
find at least something in decimal degrees, but without considerable
success.
According to the MapFile Reference - 0 uses the tolerance value set in the
map file, while any other value should use 'ground values'.
So I tried other values, just for curiosity: 400 finds the nearest 5
features - but this is too far for being a 400Km radius. At 500
whatsoever-units all features are found and below 400 nothing is found....
This makes me think that it's not the code that's wrong, but something
related to Proj4. ???

I'm using MS 4.2, Mapscript and PHP 4.3.7, on Win2000
The Proj-files from MapServer work just fine, while those distributed by
Maptools.org gave me some problems.
I wonder if I should update or try to get the Mapscript proj-files working
properly somehow?

Thanks for your comments,
Stefanie Weykam
Ps: refering to another interesting comment a couple of days ago - Has
anybody tried to draw a circle transforming the symbol coordinates from
image to map coordinates so that the circle size matches the buffer distance
of a query? Is this possible at all?



More information about the mapserver-users mailing list