confused about QueryByPoint (FWD)

Thomas E Burk teb at MALLIT.FR.UMN.EDU
Wed Aug 4 17:14:12 EDT 2004


Forwarding this to the new list.



------------- Begin Forwarded Message -------------

From: "Michael McGrath" <mmcgrath at umd.edu>
To: mapserver-users at lists.gis.umn.edu
X-Sender: mmcgrath
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by lists.gis.umn.edu id
i74IW7xA007380
Subject: [Mapserver-users] confused about QueryByPoint
X-BeenThere: mapserver-users at lists.gis.umn.edu
X-Mailman-Version: 2.0.13
List-Unsubscribe: <http://lists.gis.umn.edu/mailman/listinfo/mapserver-users>,
<mailto:mapserver-users-request at lists.gis.umn.edu?subject=unsubscribe>
List-Id: Mapserver Users Mailing List (Appropriate for general users)
<mapserver-users.lists.gis.umn.edu>
List-Post: <mailto:mapserver-users at lists.gis.umn.edu>
List-Help: <mailto:mapserver-users-request at lists.gis.umn.edu?subject=help>
List-Subscribe: <http://lists.gis.umn.edu/mailman/listinfo/mapserver-users>,
<mailto:mapserver-users-request at lists.gis.umn.edu?subject=subscribe>
List-Archive: <http://lists.gis.umn.edu/pipermail/mapserver-users/>
Date: Wed, 04 Aug 2004 14:31:55 -0400

Hi,

I'm new to Mapserver and PHP/Mapscript, and I'm currently in the process of
figuring out how to perform queries. I have a simple map file with 3 layers
and a small php script for zooming/panning and performing queries. Zooming and
panning works fine, but when I perform queries I get strange results. If I set
the query mode to MS_MULTIPLE, the function always returns every feature in
the layer. If I change it to MS_SINGLE, I always get a feature that is nowhere
near the feature I clicked on. Changing the UNITS attribute for the MAP
results in no features being returned at all, and changing the TOLERANCEUNITS
to anything besides miles also results in no features being returned. Here is
my mapfile:

MAP
STATUS ON
IMAGETYPE PNG
EXTENT -79.487152 37.911423 -75.045898 39.724014
SIZE 800 600
SHAPEPATH "maps"
IMAGECOLOR 255 255 255
SYMBOLSET '/var/www/htmldocs/mapfiles/etc/symbols/symbols.sym'
#UNITS meters
WEB
IMAGEPATH "/var/www/htmldocs/mapfiles/tmp/"
IMAGEURL "/mapfiles/tmp/"
END

#PROJECTION
# "proj=utm"
# "ellps=GRS80"
# "zone=18x"
# "north"
# "no defs"
#END

LAYER
NAME "counties"
METADATA
"DESCRIPTION" "CNAME"
"RESULT_FIELDS" "COUNTY"
END
DATA "counties"
STATUS ON
TYPE POLYGON
CLASS
COLOR 168 214 138
OUTLINECOLOR 56 32 11
TEMPLATE 'dummy'
END
TOLERANCE 3
TOLERANCEUNITS miles
#PROJECTION
# "proj=utm"
# "ellps=GRS80"
# "zone=15"
# "north"
# "no defs"
#END
END

LAYER
NAME "interstate"
DATA "interstate"
STATUS ON
TYPE LINE
CLASS
COLOR 0 0 0
SIZE 2
END
TOLERANCE 10
END

LAYER
NAME "detectors"
METADATA
"DESCRIPTION" "Lat"
"RESULT_FIELDS" 'Latitude'
END
DATA "detectors"
STATUS ON
TYPE POINT
CLASS
COLOR 255 0 0
SYMBOL 'circle'
SYMBOL 'circle'
SIZE 3
TEMPLATE "dummy"
END
TOLERANCE 3
TOLERANCEUNITS miles
END

OUTPUTFORMAT
NAME png
DRIVER "GD/png"
MIMETYPE "image/png"
IMAGEMODE PC256
EXTENSION "png"
END
END


And here is the php code responsible for performing the query:

$detLayer = $map->getLayerByName("counties");
$detLayer->queryByPoint($my_point, MS_SINGLE, -1);
$count_results = $detLayer->getNumResults();
echo $count_results . '<br>';
if ($count_results > 0) {
$detLayer->open();
$selFields = explode(" ", $detLayer->getMetaData("CNAME"));

$oRes = $detLayer->getResult(0);
$oShape = $detLayer->getShape($oRes->tileindex,$oRes->shapeindex);

$aResBoundBox = array($oShape->bounds->minx, $oShape->bounds->miny,
$oShape->bounds->maxx, $oShape->bounds->maxy);

$ID = $oShape->values['COUNTY'];
echo $ID;
$oShape->free();
}
else
{
echo "nothing found<br>";
}

The version of mapserver we are using here was compiled without proj4 support,
which is why all the projection sections in the mapfile are commented out.
Could that be my problem?

Any light you could shed on this problem would be greatly appreciated

Thanks,
Mike McGrath
mmcgrath AT umd DOT edu




_______________________________________________
Mapserver-users mailing list
Mapserver-users at lists.gis.umn.edu
http://lists.gis.umn.edu/mailman/listinfo/mapserver-users


------------- End Forwarded Message -------------



More information about the mapserver-users mailing list