#1 Wed 17 March 2010 20:28
- calito
- Participant actif
- Date d'inscription: 2 Jun 2008
- Messages: 112
phpMapScript - Affichage de la carte
Bsr tout'l monde,
Voici mon fichier phpmapscript que j'ai sauvegarder "index.php" dans mon repertoir C:\ms4w\Apache\htdocs\max
Code:
<?php
dl("php_mapscript.dll");
$map_path="/ms4w/apps/france/data";
$map = ms_newMapObj($map_path."/dep.map");
$image=$map->draw();
$image_url=$image->saveWebImage();
echo "toot";
?>
<HTML>
<HEAD>
<TITLE>Example 1: Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC=<?php echo $image_url;?> >
</BODY>
</HTML>lorsque je lance a partir de mon browser: http://localhost/max/
Il me retourne ces 3 messages:
Code:
[b]Warning:[/b] [MapServer Error]: getDouble(): Parsing error near (,):(line 3) in C:\ms4w\Apache\htdocs\max\index.php on line 5 [b]Warning:[/b] Failed to open map file /ms4w/apps/tuto_toto/data/dep.map in C:\ms4w\Apache\htdocs\max\index.php on line 5 Fatal error: Call to a member function draw() on a non-object in C:\ms4w\Apache\htdocs\max\index.php on line 6
Hors ligne
#2 Thu 18 March 2010 14:06
- calito
- Participant actif
- Date d'inscription: 2 Jun 2008
- Messages: 112
Re: phpMapScript - Affichage de la carte
Quelqu'un peut m'aider svp? Merci
Hors ligne
#3 Thu 18 March 2010 15:50
- nicolas.leclerc
- Participant actif
- Date d'inscription: 8 Apr 2009
- Messages: 78
Re: phpMapScript - Affichage de la carte
essaie ça
Code:
<?php
dl("php_mapscript.dll");
$map_path="/ms4w/apps/france/data/";
$map = ms_newMapObj($map_path."dep.map");
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
echo "toot";
?>vérifie également tout tes chemins.
Dernière modification par nicolas.leclerc (Thu 18 March 2010 15:55)
Hors ligne
#4 Thu 18 March 2010 16:10
- calito
- Participant actif
- Date d'inscription: 2 Jun 2008
- Messages: 112
Re: phpMapScript - Affichage de la carte
Oh lala, ça'n marche pas.
Erreur dans la ligne 4
$map_path="/ms4w/apps/france/data/";
Code:
unexpected T_VARIABLE ligne 4
Hors ligne
#5 Thu 18 March 2010 16:32
- nicolas.leclerc
- Participant actif
- Date d'inscription: 8 Apr 2009
- Messages: 78
Re: phpMapScript - Affichage de la carte
mets tes datas et ton mapfile dans htdocs
voici un code qui fonctionnait pour moi, mes 3 fichiers (test.php;carto.css;toto.map) sont à la racine du htdocs
Code:
<?php
dl('php_mapscript.dll');
$map_file ="toto.map";
$map = ms_newMapObj($map_file);
$image = $map->draw();
$image_url = $image->saveWebImage(MS_PNG,1,1,0);
$scale = $map->drawScaleBar();
$scale_url = $scale->saveWebImage(MS_PNG,1,1,0);
$legend = $map->drawLegend();
$legend_url = $legend->saveWebImage(MS_PNG,1,1,0);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>phpmapscript</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" media="all" type="text/css" title="carto" href="carto.css" />
</head>
<body>
<div id="scale">
<p> Echelle : <img src = <?php echo $scale_url; ?> ></p>
</div>
<div id="legend">
<p> Légende : </p>
<img src = <?php echo $legend_url; ?> >
</div>
<div id="image">
<img src = <?php echo $image_url; ?> >
</div>
</body>
</html>Dernière modification par nicolas.leclerc (Thu 18 March 2010 16:33)
Hors ligne
#6 Thu 18 March 2010 17:07
- calito
- Participant actif
- Date d'inscription: 2 Jun 2008
- Messages: 112
Re: phpMapScript - Affichage de la carte
Malgre tout ca'n marche pas. Bon ecoute, je vais te dire ce que g fait:
1- dans htdocs g mon repertoir qui s'appel : max
2- A l'interieure du repertoire (max), g un fichier php qui s'appel: index.php
3- A l'interieur de ce meme repertoire, g mon shapefile : limite_départemental_cep
4- G egalement à l'interieure de ce repertoire mon fichier mapfile : dep.map
voici la structure de mon fichier dep.map
verifier pour moi la partie SHAPEPATH S'il vous plait
Code:
MAP
IMAGETYPE PNG
EXTENT 554876.588658, 1992998.362735 855240.514318, 2222860.797225
SHAPEPATH "\ms4w\apache\htdocs\max\"
IMAGECOLOR 210 210 210
LAYER
NAME limite_departement_cep
DATA limite_departement_cep
STATUS ON
TYPE POLYGON
CLASS
STYLE
COLOR 30 30 30
OUTLINECOLOR 100 100 100
END
END
END
ENDVoici mon fichier index.php
Code:
<?php
dl("php_mapscript.dll");
$map_file = ms_newMapObj("dep.map");
$map = ms_newMapObj($map_file);
$image=$map->draw();
$image_url=$image->saveWebImage(MS_PNG,1,1,0);
echo "toot";
echo "Cadet Anatole";
?>
<HTML>
<HEAD>
<TITLE>Example 1: Displaying a map</TITLE>
</HEAD>
<BODY>
<IMG SRC=<?php echo $image_url;?> >
</BODY>
</HTML>Lorsque je lance dans mon browser http://localhost/max/, voici les messages qui appaissent:
Warning: [MapServer Error]: getDouble(): Parsing error near (,):(line 3) in C:\ms4w\Apache\htdocs\max\index.php on line 4
Warning: Failed to open map file dep.map in C:\ms4w\Apache\htdocs\max\index.php on line 4
Warning: [MapServer Error]: msDrawMap(): Unable to initialize image. in C:\ms4w\Apache\htdocs\max\index.php on line 6
Warning: [MapServer Error]: msPrepareImage(): Image dimensions not specified. in C:\ms4w\Apache\htdocs\max\index.php on line 6
Warning: [MapServer Error]: getDouble(): Parsing error near (,):(line 3) in C:\ms4w\Apache\htdocs\max\index.php on line 6
Fatal error: Call to a member function saveWebImage() on a non-object in C:\ms4w\Apache\htdocs\max\index.php on line 7
AIdez-moi, please. Aujourd'hui je veux realiser ceci. Merci bcp pour votre aide.
Hors ligne
#7 Thu 18 March 2010 20:08
- calito
- Participant actif
- Date d'inscription: 2 Jun 2008
- Messages: 112
Re: phpMapScript - Affichage de la carte
Okey, C bon maintenant. G arrivé à affciher ma carte.
Merci nicolas.
Hors ligne
#8 Thu 24 March 2011 19:23
- salyos
- Juste Inscrit !
- Date d'inscription: 24 Mar 2011
- Messages: 1
Re: phpMapScript - Affichage de la carte
Bonsoir tt le monde,
Moi aussi j'ai le même problème: j'arrive pas à afficher ma carte. en fait, il m'affiche la même erreur.
Est ce que vous pouvez m'aider svp
Hors ligne


