[Mapserver-users] Dyanic Point with Zoom

Eric Bridger eric at gomoos.org
Wed Nov 5 10:52:43 EST 2003


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