[Mapserver-users] Dyanic Point with Zoom
Brian Cunningham
BRC at capindex.com
Wed Nov 5 13:21:44 PST 2003
When I remove $image=$map->draw(); the point draws but it is not located
in the center and my other layer does not show up, which does show with
the $map->draw().
Is there something wrong with my map file?
MAP
NAME TEST
STATUS ON
SIZE 600 450
SYMBOLSET ../etc/symbols.sym
EXTENT -141.017718 41.679738 -52.619173 83.115060
UNITS DD
SHAPEPATH "../data"
IMAGECOLOR 204 204 204
FONTSET ../etc/fonts.txt
WEB
TEMPLATE MapTemplate.html
IMAGEPATH "/tmp/ms_tmp/"
END
#Tab layers
LAYER
NAME prv
TYPE POLYGON
CONNECTIONTYPE OGR
CONNECTION "../data/prv.tab"
STATUS DEFAULT
CLASS
OUTLINECOLOR 0 255 0
COLOR 204 255 153
END
END # Layer
LAYER
NAME "point_layer"
TYPE point
STATUS on
CLASS
NAME 'point_layer'
STYLE
COLOR 0 0 255
SIZE 27
SYMBOL 'circle'
END
END
END
END
-----Original Message-----
From: Eric Bridger [mailto:eric at gomoos.org]
Sent: Wednesday, November 05, 2003 10:53 AM
To: Brian Cunningham
Cc: Mapserver List
Subject: Re: [Mapserver-users] Dyanic Point with Zoom
Brian,
There is really no need to call $pt_layer->draw(). You already called
$pt->draw(). Just a guess, but try removing the layer->draw().
Actually, now that I look at, no need to call $map->draw() either. You
should just call $map->prepareImage(), $pt->draw(), then
$image->saveWebImage().
HTH
On Wed, 2003-11-05 at 20:18, Brian Cunningham wrote:
> Hello all-
> I am stuck and can't figure out what Im doing wrong. I am trying to
> pass Lat/Long coords which will create a point and zoom to that point.
> What happens is it zooms to the right coords but the created point
> object doest show. I figure maybe something is missing or in the
> wrong order. I have browsed the archive listing and from what I
> gather it looks right... Below is everything
> Thanks in advance!
> Brian
>
> -------------------------------------------------------------------
> #Point Layer
> LAYER
> NAME "point_layer"
> TYPE point
> STATUS on
> CLASS
> NAME 'point_layer'
> STYLE
> COLOR 0 0 255
> SIZE 27
> SYMBOL 'circle' #(*note: my circle is
> defined in a symbol set file)
> END
> END
> END
> -------------------------------------------------------------------
> <html>
> <?php
> dl('php_mapscript.dll');
> $map_path="../htdocs/";
>
> //CREATE INSTANT OF mapOBJECT
> $map = ms_newMapObj($map_path."test3.map");
> $image = $map->prepareImage();
> $image=$map->draw();
>
> // CREATE NEW layerObject
>
> $pt_layer = ms_newLayerObj($map);
> $pt_layer = $map->getLayerByName("point_layer");
>
> $pt_layer->set("status", 1);
>
> //SET NEW POINT OBJECT
> $pt = ms_newPointObj();
>
> //Pass static coords
> $lon = -73; /*User input*/
> $lat = 46; /*User input*/
>
> //SET POINT OBJECT
> $pt->setXY($lon, $lat);
> $pt->draw($map, $pt_layer, $image, 0, "");
> $pt_layer->set('status', MS_ON);
> $pt_layer->draw($image);
>
> // ZoomPoint - zooooom to point
> $map->zoompoint(75,$pt,$map->width,$map->height,$map->extent);
>
> //Create web image
> $image=$map->draw();
> $image_url = $image->saveWebImage(MS_PNG,1,1,0);
> ?>
> <html>
> <HEAD>
> <TITLE>POINT CREATION</TITLE>
> </HEAD>
> <BODY>
> <CENTER>
> <form name="form1" method="get">
>
> <center><h1>POINT
> CREATION</h1></center><br>
> <INPUT TYPE=IMAGE NAME="img"
SRC="/tmp/ms_tmp/<?php
> echo $image_url; ?>">
> </form>
> </CENTER>
> </BODY>
> </HMTL>
> -------------------------------------------------------------------
>
> _______________________________________________
> Mapserver-users mailing list Mapserver-users at lists.gis.umn.edu
> http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
>
More information about the MapServer-users
mailing list