Adding dynamic points; clicking on point not working
Bart van den Eijnden
bartvde at XS4ALL.NL
Sun Jun 19 07:53:09 PDT 2005
Did you try setting a TOLERANCE on your LAYER?
eg:
TOLERANCEUNITS PIXELS
TOLERANCE 3
Best regards,
Bart
On Sat, 18 Jun 2005 20:25:27 +0200, Hoeven, Maarten van der
<Maarten.van.der.Hoeven at KNMI.NL> wrote:
> Dear list,
>
> I'm working with MapServer 4.6.0, PHP-Mapscript (Linux Suse9.2, Apache)
> and I managed to query my (MySQL) database, and plot dots on the
> appropriate lat/lon (see query below). However, I still can't manage to
> retrieve some additional information, when clicking on a dot (displaying
> all dots on a map is working okay). Im running with a modified
> Gmap-demo, but the functionality is intact. To be specific, when I click
> on a point, I got the message "Nothing found at query location."
>
> Can you give me some hints/tipsss/clues? The code below is written by
> using some earlier examples on the list.
>
> My (1) query and plotting by using PHP-mapscript, and below that (2) my
> map-file.
>
> Regards,
> Maarten van der Hoeven
>
> 1. ============
>
> $layerObj = $gpoMap->getLayerByName("points01");
> $classObj = $layerObj->getClass(0);
>
> $query = "SELECT sta_id, lat/3600 as y, lon/3600 as x FROM stations;";
> $result = mysql_query($query);
>
> $i=0;
> while (($row = mysql_fetch_array($result)))
> {
> $pointObj = ms_newPointObj();
> $pointObj->setXY($row['x'], $row['y']);
> $line = ms_newLineObj();
> $line->add($pointObj);
> $shp = ms_newShapeObj(MS_SHAPE_POINT);
> $shp->add($line);
> $shp->{index} = $i;
> if ($layerObj->addFeature($shp) == -1)
> {
> echo "addfeature failed!";
> }
> $i++;
> $pointObj->draw($gpoMap, $layerObj, $img, 0, 'sta_id');
> }
>
> 2. ============
> #
> # Start of map file
> #
> # $Id: gmap75.map,v 1.23 2003/02/25 19:46:42 daniel Exp $
> #
> NAME DEMO
> STATUS ON
> DEBUG ON
> SIZE 400 300
> SYMBOLSET ../etc/symbols.sym
> EXTENT -70 10 70 80
> UNITS dd
> SHAPEPATH "../data"
> IMAGECOLOR 255 255 255
> FONTSET ../etc/fonts.txt
>
> OUTPUTFORMAT
> NAME png
> DRIVER "GD/PNG"
> MIMETYPE "image/png"
> IMAGEMODE PC256
> EXTENSION "png"
> END
>
> QUERYMAP
> STATUS ON
> STYLE SELECTED
> COLOR 255 0 0
> END
>
> #
> # Start of web interface definition
>
> WEB
> MINSCALE 2000
> MAXSCALE 50000000
> IMAGEPATH "/webdata/ecad/htdocs/tmp/"
> IMAGEURL "/tmp/"
> LOG /tmp/gmap.log
> END
>
> #
> # Start of reference map
> #
> REFERENCE
> IMAGE images/keymap.png
> EXTENT -2200000 -712631 3072800 3840000
> STATUS ON
> COLOR -1 -1 -1
> OUTLINECOLOR 255 0 0
> SIZE 120 90
> END
>
> #
> # Start of legend
> #
> LEGEND
> KEYSIZE 18 12
> LABEL
> TYPE BITMAP
> SIZE MEDIUM
> COLOR 0 0 89
> END
> STATUS ON
> END
>
> #
> # Start of scalebar
> #
> SCALEBAR
> IMAGECOLOR 255 255 255
> LABEL
> COLOR 0 0 0
> SIZE SMALL
> END
> SIZE 350 5
> COLOR 255 255 255
> BACKGROUNDCOLOR 255 0 0
> OUTLINECOLOR 0 0 0
> UNITS kilometers
> INTERVALS 10
> STATUS ON
> END
>
> LAYER
> NAME points01
> METADATA
> "RESULT_FIELDS" "sta_id"
> END
> TEMPLATE void
> TYPE POINT
> STATUS ON
> SYMBOLSCALE 50000
> LABELITEM 'sta_id'
> CLASSITEM 'sta_id'
> CLASS
> NAME 'sta_id'
> STYLE
> OUTLINECOLOR 255 255 255
> COLOR 255 0 0
> SYMBOL 7
> SIZE 8
> MAXSIZE 15
> MINSIZE 15
> END
> LABEL
> MINFEATURESIZE -1
> POSITION UC
> PARTIALS FALSE
> COLOR '#000080'
> SIZE GIANT
> END
> END
> END
>
> END # Map File
>
>
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the MapServer-users
mailing list