[mapserver-users] No points selected with queryByShape

Lime, Steve D (MNIT) Steve.Lime at state.mn.us
Tue Sep 17 17:23:52 PDT 2013


A layer must be queryable and ON before you can run query operations on it. That is:

LAYER
  NAME 'business_point_locations'
  STATUS ON # or DEFAULT
  TYPE POINT
  ...
  TEMPLATE void
END

Steve


________________________________
From: Michael McInnis [mmcinnis59 at msn.com]
Sent: Tuesday, September 17, 2013 5:23 PM
To: Lime, Steve D (MNIT); mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] No points selected with queryByShape

Not sure I follow this.

Template is an empty layer in my map file we use to add shapes to for display.

My Feature layer is a shapefile of business point locations.

What does queryable mean in relation to a shapefile of points?

Michael McInnis 6033 44th Ave. N.E. Seattle, WA 98115 206 517-4701

________________________________
From: Steve.Lime at state.mn.us
To: mmcinnis59 at msn.com; mapserver-users at lists.osgeo.org
Subject: RE: [mapserver-users] No points selected with queryByShape
Date: Tue, 17 Sep 2013 22:16:16 +0000


Is your feature layer queryable? That is, does is have a value set for TEMPLATE? Even ‘TEMPLATE void’ will do.



Steve



From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of Michael McInnis
Sent: Tuesday, September 17, 2013 4:51 PM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] No points selected with queryByShape



I'm baffled on this one!

I get a shape object $circle and I have a point layer $bizLayer.
I know they are both valid as they overlay as expected on my map.

When I call printBusiness to use queryByShape to get the points in the shape it always returns 0 for $numResults.

Am I missing a step somewhere?

// Get shape from point and radius
$circle = createCircle($latlonPoint,$radius);

echo 'Biz Count : ';
$bizCount = printBusiness($bizLayer,$circle);
echo $bizCount;

// Draw all the layers per basic1.map
$image=$map->draw();

// Draw circle - reads shp->draw(map,template,image);
$circle->draw($map,$emptyLayer,$image);

$image_url=$image->saveWebImage();


function printBusiness($featureLayer,$shp){

    $featureLayer->queryByShape($shp);
    $numResults = $featureLayer->getNumResults();

    if($numResults > 0){
        echo 'if';
        return $numResults;
    }else{
        echo 'else';
        return 0;
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20130918/18aacfb3/attachment-0001.html>


More information about the mapserver-users mailing list