php_Mapscript - display new layer

Julien Bessiere julien.63 at FREE.FR
Tue Jun 6 09:39:49 PDT 2006


Hi,
I'm quite new in php_mapscript. So i start with simple thing!
I try to display a point throught map_script, but i doesn't appear on the map.
Could you what's wrong in my file?
How could i define the location (-90.0 , 10.0) of this point?
Do you have some good tutorials or example for using the php_mapscript class?
Thx for your help.
Julien
____________________________________________
Php file :

<?php
dl('php_mapscript.so');
$map_path="/home/julien/fgs/www/htdocs/12/very_simple_example/";
$map_name = "simple.map";

$map = ms_newMapObj($map_path.$map_name);
$layer = ms_newLayerObj($map);
$layer->set("name","bird");
$layer->set("type",MS_DEFAULT);
$layer->set("type",MS_LAYER_POINT);
$class = ms_newClassObj($layer);
	$style = ms_newStyleObj($class);
		$style->color->setRGB(0,0,0);
		$style->set('size','40');
		$style->outlinecolor->setRGB(255,0,0);

$image=$map->draw();
$img_path = "/home/julien/fgs/www/htdocs/tmp/";
$map_id = sprintf("%0.6d",rand(0,999999));
$image_name = "third_simple".$map_id.".png";
$image->saveImage($img_path.$image_name);
$image_url = '../../tmp/'.$image_name;
?>

<HTML>
<HEAD>
    <TITLE>:::: Displaying a very simple map ::::</TITLE>
</HEAD>
<BODY>
    <IMG SRC=<?php echo $image_url; ?> >
</BODY>
</HTML>

_________________________________
Map file:

NAME "simple"
UNITS DD
EXTENT -180.00 -90.00 180.00 90.00
SIZE 700 400
IMAGECOLOR 100 100 100
IMAGETYPE PNG
SHAPEPATH "/home/julien/fgs/www/htdocs/12/data"
FONTSET "/home/julien/fgs/www/htdocs/fontset.txt"

SYMBOL
     NAME "point"
     TYPE pixmap
     IMAGE "/home/julien/fgs/www/htdocs/12/images/point.png"
END

SYMBOL
     NAME "rond"
	TYPE ELLIPSE
     POINTS 1 1 END
END

#####################################
# countries layer
#
LAYER
     NAME "Country"
     DATA "countries"
     STATUS on
     TYPE polygon
     LABELCACHE on
     LABELITEM "COUNTRY"
     CLASS
          STYLE
               COLOR 50 50 100
          END
     END
END

END  mapfile



More information about the MapServer-users mailing list