[mapserver-users] MapScript: HOW to get query result in NEW img
Pietro Giannini
pgiannini at bytewise.it
Fri Jun 27 08:43:43 PDT 2008
Marco,
the querybypoint() method don't affect the extent of the map.
do you set in some part of your code the extent of the map?
I suppose in the html code you get the extent, e.g :
<form name="main" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>>"
<input type="hidden" name="extent" value="<?php echo
$mapobj->extent->minx." ".$mapobj->extent->miny."
".$mapobj->extent->maxx." ".$mapobj->extent->maxy; ?>">
...
</form>
to, in the postback, set the extent of the map with $mapobj->setextent() -
or zoompoint(), zoomrectangle(), zoomscale()...
without this setting the map is drawn in the extent defined in your mapfile.
maybe you have a "zoom" parameter set which influences the extent?
pls post the html code too.
On Ven, Giugno 27, 2008 15:55, Marco Foi wrote:
> I need to query a map and have the result displayed in a different image.
> BUT the main image is affected by the query and
> gets recentered on the SAME EXTENT of the query map.
>
> I'm using PHP MapScript
>
> Here is the 'core' of my code:
>
> // create a new point object at the clicked
> coordinates, to use it in queryByPoint
> $querypoint = ms_newPointObj();
> //$cy & $cy are the conversion in map units of
> the image coordinates of the queryed point on the map
> $querypoint->SetXY($cx, $cy);
> [...]
> //define the layer that will be queryed
> $layertoquery =$map->getLayerByName('geology');
> //perform the query
> $res = $layertoquery->queryByPoint($querypoint, MS_SINGLE,
> ($map->cellsize)*5);
>
> //FIRST draw the map image
> $image=$map->draw();
> $image_url=$image->saveWebImage();
>
> //THEN draw the query image
> $thequerymap = $map->drawQuery();
> $querymap_url=$thequerymap->saveWebImage();
>
>
> BUT $image_url IS AFFECTED by the query and
> displays che same extent of $querymap_url
>
> How can I avoid this?
>
> Marco
>
>
>
> At 18.48 25/06/2008, you wrote:
> ------------------------------------------------------------
> Marco,
> I suppose you are using mapscript - php or other - in your application.
> The postback of your page send not only the click point, but - maybe -
> other parameters.
> Whit some javascript you can set a parameter wich tell your app not to
> affect the main map, but only the query map.
>
> Please post your code, html and scripts, for more specific help.
>
> ciao
> ..........................pg
>
>
> --
> Pietro Giannini
> Bytewise srl - Area GIS
> 41°50'38.58"N 12°29'13.39"E
>
>
>
> On Mer, Giugno 25, 2008 15:46, Marco Foi wrote:
> > Hi all!
> >
> > I need to let the user queryByPoint (click) on a
> > "mainmap" and get the result displayed on a
> > second image WITHOUT influencing the "mainmap".
> >
> > I tryed but the when i use the drawQuery() method
> > it seems that also the "mainmap" is affected: it
> > gets zoomed to the center of the feature (poligon) queryed.
> > At the end the only difference between the two
> > maps is that the image result of the query has
> > the feature HILITED while the mainmap not.
> >
> > How can I avoid the problem?
> >
> > Marco Foi
> >
> > Dip. di Scienze della Terra "A.Desio"
> > Sezione di Geologia e Paleontologia
> > http://www.gp.terra.unimi.it
> > Università degli Studi di Milano
> > Via.Luigi Mangiagalli n.34 Cap.20133 Milano
> > Laboratorio Informatico - Tel. 02- 503 15 503
> > E-mail marco.foi at unimi.it
> >
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/mapserver-users
> >
>
> ------------------------------------------------------------
>
>
More information about the MapServer-users
mailing list