[Mapserver-users] Dyanic Point with Zoom

Brian Cunningham BRC at capindex.com
Wed Nov 5 15:18:13 EST 2003


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>
-------------------------------------------------------------------




More information about the mapserver-users mailing list