[mapserver-users] QueryByPoint problem: why always the same feature?

Pietro Giannini pgiannini at bytewise.it
Mon Apr 21 05:09:44 PDT 2008


Carlo,
I think the cache is refreshed each call of $layer->queryByPoint(point,
mode, buffer).
Remember to set the "mode" = MS_MULTIPLE to obtain more than one result,
the point is a $pointObj in GEOGRAPHIC coordinates, the buffer set to 0
get the default of the TOLERANCE (in pixels) of the mapfile, otherwise you
can specify in ground units a circle around the point for obtain the
results.

Look here:
http://mapserver.gis.umn.edu/docs/reference/phpmapscript-class
for a good guide about.

here a piece of code (it work):

	$res = @$layer->queryByPoint($qpoint,MS_MULTIPLE,0);
	if (@$layer->getNumResults() > 0) {
		$layer->open();
		for ($i=0;$i<$layer->getNumResults();$i++) {
			$resCache = $layer->getResult($i);
			$shape = $layer->getShape(-1,$resCache->shapeindex);
			echo $shape->values['fieldname']."<br>";
			// .... etc.
		}
		$layer->close();
	}

ciao
..........................pg


-- 
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E





On Lun, Aprile 21, 2008 13:20, Carlo Pelliconi wrote:
> Hi all.
> I use PHPMapScritp with Mapserver 4.10 on Debian Etch.
> I do a series of querybypoint, but the answer is always the first feature!
> I think it could be a resultCacheMember problem. How can I free all
> cache about previous query results?
> New results of next query are appended to previous results or getResult
> goes to a new set at any new query?
> It is sufficient to close the queried layer ad to free the
> $shp=getResult(...)?
> Thank you very much.
> Carlo
>
> --
> ing. Carlo Pelliconi
> c.pelliconi at sis-ter.it
> SIS.TER S.p.A.
> www.sis-ter.it
> via Mentana, 10
> 40026 Imola (BO) Italy
> tel     +39 0542 364034
> fax     +39 0542 612130
>
>
>
>
> ATTENZIONE!
> Questo documento è indirizzato esclusivamente al destinatario. Tutte le
> informazioni ivi contenute, compresi eventuali allegati, sono soggette
> a riservatezza secondo i termini del D.Lgs. 196/2003 in materia di
> "privacy" e ne è proibita l'utilizzazione da parte di altri soggetti. Si
> ricorda che la diffusione l'utilizzo e/o la conservazione dei dati
> ricevuti per errore costituisce violazione di carattere penale ai sensi
> dell'art. 616 Codice penale (Violazione, sottrazione e soppressione di
> corrispondenza). Se avesse ricevuto per errore questo messaggio, La
> preghiamo cortesemente di contattare il mittente al più presto e di
> cancellare il messaggio subito dopo. Grazie.
>
> ATTENTION!
> This message is being sent from Sis.Ter S.p.A. and may contain information
> which is confidential or privileged. If you are not the intended
> recipient, please advise the sender immediately by reply e-mail and delete
> this message and any attachments without retaining a copy. Any
> unauthorized use of the content of this message is a breach of your duty
> to respect the confidentiality of the correspondence between other persons
> and can expose the responsible party to civil and/or criminal penalties
> (D.Lgs. 196/2003 "Tutela della privacy" e art. 616 Codice penale
> "Violazione, sottrazione e soppressione di corrispondenza"), and may
> constitute a more serious offence. Thanks.
>
> ACHTUNG!
> Dieses Dokument ist ausschließlich dem Empfänger vorbehalten. Die darin
> enthaltenen Informationen, auch jene in etwaigen Anlagen, gelten im Sinne
> des Dekrets Nr. 196/2003 in Sachen "Privacy" als streng vertraulich und
> dürfen von anderen Personen nicht verwende werden. Wer diese Mitteilung
> irrtümlicherweise erhält ist gebeten uns umgehend zu informieren und
> anschließend die Mitteilung zu vernichten. Vielen Dank.
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
>


-- 
Pietro Giannini
Bytewise srl - Area GIS
41°50'38.58"N 12°29'13.39"E




More information about the MapServer-users mailing list