[mapserver-users] Can anyone help me please???/
Ruslan Nuryadin
nuryadin at gmail.com
Thu Aug 28 07:45:09 PDT 2008
Try these:
1. On your map file:
IMAGEURL "/ms_tmp/"
2. On your PHP code, add:
<FORM METHOD=POST NAME="anything">
<input type=image name=mapa src=<?php echo $image_url; ?>>
</FORM>
Regards,
Ruslan
On Thu, Aug 28, 2008 at 6:01 PM, ramya srinivasan <hellomps at gmail.com> wrote:
> HI,
> I have to display the user clicked point on the map. But i don get the
> point in the map.. Can any one please correct my code..
> <?php
> dl('php_mapscript.dll');
> // Default values and configuration
> $map_file="./usa12.map";
> $map = ms_newMapObj($map_file);
> if ( isset($HTTP_POST_VARS["mapa_x"]) && isset($HTTP_POST_VARS["mapa_y"]))
> {
> $my_point = ms_newpointObj();
> $my_point->setXY($HTTP_POST_VARS["mapa_x"],$HTTP_POST_VARS["mapa_y"]);
> $nGeoX = Pix2Geo($my_point->x, 0,$map->width , $map->extext->minx,
> $map->extent->maxx, 0);
> $nGeoY = Pix2Geo($my_point->y, 0, $map->height, $map->extent->miny,
> $map->extent->maxy, 1);
> $point=ms_newpointobj();
> $point->setXY($nGeoX,$nGeoY);
> $layer=$map->getLayerByName("US state boundaries");
> if (@$layer->queryByPoint($point,MS_SINGLE ,0) == MS_SUCCESS)
> {
> $image_from_query=$map->drawQuery();
> $image_from_query_url=$image_from_query->saveWebImage();
> }
> }
> function Pix2Geo($nPixPos, $dfPixMin, $dfPixMax, $dfGeoMin, $dfGeoMax,
> $nInversePix)
> {
>
> $dfWidthGeo = $dfGeoMax - $dfGeoMin;
> $dfWidthPix = $dfPixMax - $dfPixMin;
>
>
> $dfPixToGeo = $dfWidthGeo / $dfWidthPix;
>
> if (!$nInversePix)
> $dfDeltaPix = $nPixPos - $dfPixMin;
> else
> $dfDeltaPix = $dfPixMax - $nPixPos;
>
> $dfDeltaGeo = $dfDeltaPix * $dfPixToGeo;
>
>
> $dfPosGeo = $dfGeoMin + $dfDeltaGeo;
>
>
>
> return ($dfPosGeo);
>
> }
> $image=$map->draw();
> $image_url=$image->saveWebImage();
> ?>
> map file
> MAP
> NAME USA1
> STATUS ON
> SIZE 800 500
> IMAGETYPE PNG
> IMAGECOLOR 200 200 200
> SHAPEPATH "C:\ms4w\Apache\data"
> EXTENT -8000000 300000 5000000 1500000
> UNITS METERS
> PROJECTION
> "proj=lcc" "lat_1=32" "lat_2=44" "lat_0=38" "lon_0=-100" "x_0=0"
> "y_0=0" "ellps=GRS80" "datum=NAD83"
> END
> WEB
> IMAGEPATH "C:\ms4w\tmp\ms_tmp"
> IMAGEURL "C:\ms4w\tmp\ms_tmp"
>
> END
>
> LAYER
> NAME "US state boundaries"
> TYPE POLYGON
> STATUS ON
> DATA "statesp020"
> PROJECTION
> "proj=latlong"
> "ellps=GRS80"
> "datum=NAD83"
> END
>
> CLASS
> NAME "US states"
> OUTLINECOLOR 175 175 175
> COLOR 150 150 150
> SYMBOL 0
> TEMPLATE "hello.html"
> END
> END
>
> END
>
>
> _______________________________________________
> 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