Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

API google maps

4 réponses
Avatar
Fulcanelli
Bonjour,

Je tripatouille google maps et je me retrouve fasse =E0 un petit
probl=E8me voila le code :

</head>
<body>
<div id=3D"map" style=3D"width: 800px; height: 600px"></div><!--
Affichage de la carte-->
<script type=3D"text/javascript">
//<![CDATA[
var icon =3D new GIcon();
icon.iconSize =3D new GSize(12,20);
icon.shadowSize =3D new GSize(20,22);
icon.iconAnchor =3D new GPoint(6,20);
icon.infoWindowAnchor =3D new GPoint(5,1);

var lavoir =3D new GIcon(icon, 'http://labs.google.com/ridefinder/
images/mm_20_red.png', null, 'http://labs.google.com/ridefinder/
images/
mm_20_shadow.png');
var eglise =3D new GIcon(icon, 'http://labs.google.com/ridefinder/
images/mm_20_green.png', null, 'http://labs.google.com/ridefinder/
images/mm_20_shadow.png');
var chateau =3D new GIcon(icon, 'http://labs.google.com/ridefinder/
images/mm_20_blue.png', null, 'http://labs.google.com/ridefinder/
images/mm_20_shadow.png');

var map =3D new GMap2(document.getElementById("map"));
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
map.addControl(new GScaleControl());
map.addControl(new GOverviewMapControl());

map.setCenter(new GLatLng(47.806667, 4.292778), 13, G_NORMAL_MAP);

function createMarker(point,number,icone) {
var icon =3D icone;
var marker =3D new GMarker(point,icon);
var html =3D number;
GEvent.addListener(marker,"click", function ()
{marker.openInfoWindowHtml(html);});
return marker;
};
<?php
$link =3D mysql_connect("","","") or die("Ne peut se
connecter :".mysql_error());
mysql_selectdb("",$link) or die ("Ne peut se connecter =E0 la table :
"=2Emysql_error());

$result =3D mysql_query("SELECT * FROM test",$link);
if (!$result) {
echo "Pas de resultats";
}
while ($row =3D mysql_fetch_array($result)) {
echo "var point =3D new GLatLng(" . $row['lat'] . "," .
$row['lng'] .
");\n";
echo "var marker =3D createMarker(point, '". $row['nom'] . "',
'" .
$row['type'] ."');\n";
echo "map.addOverlay(marker);\n";
echo "\n";
}
mysql_close($link);
?>
//]]>
</script>

</body>
</html>

Tout fonctionne impec (pour voir http://www.gael-raoux.fr/cartes/test_googl=
e_maps_mysql.php
) sauf que mes marqueurs devraient =EAtre de trois couleurs diff=E9rentes,
et la non, je pense =E0 un d=E9faut de passage de param=E8tre au niveau de
la fonction createMarker.

Je s=E8che, merci d'avance.

4 réponses

Avatar
Olivier Miakinen
Le 10/09/2007 09:23, Fulcanelli a écrit :

Tout fonctionne impec (pour voir http://www.gael-raoux.fr/cartes/test_google_maps_mysql.php
) sauf que mes marqueurs devraient être de trois couleurs différentes,
et la non, je pense à un défaut de passage de paramètre au niveau de
la fonction createMarker.



Juste pour être sûr : ce ne serait pas à cause du problème de charset
détecté par le validateur ?

http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fwww.gael-raoux.fr%2Fcartes%2Ftest_google_maps_mysql.php
<cit.>
Sorry, I am unable to validate this document because on line 57 it
contained one or more bytes that I cannot interpret as utf-8 (in other
words, the bytes found are not valid values in the specified Character
Encoding). Please check both the content of the file and the character
encoding indication.

The error was: utf8 "xE2" does not map to Unicode
</cit.>

Pour info, le code xE2 code un « â » en ISO-Latin-1.
Avatar
Olivier Miakinen
Le 10/09/2007 09:35, Olivier Miakinen a écrit :

http://www.gael-raoux.fr/cartes/test_google_maps_mysql.php



Pour info, le code xE2 code un « â » en ISO-Latin-1.



C'est même probablement celui de « Château de Jully ».
Avatar
Fulcanelli
On 10 sep, 09:37, Olivier Miakinen <om+ wrote:
Le 10/09/2007 09:35, Olivier Miakinen a écrit :



>>http://www.gael-raoux.fr/cartes/test_google_maps_mysql.php

> Pour info, le code xE2 code un « â » en ISO-Latin-1.

C'est même probablement celui de « Château de Jully ».



Problème résolu avec cette page http://code.google.com/support/bin/answ er.py?answere622&topic369
cela donne http://www.gael-raoux.fr/cartes/test_google_maps_mysql_5.php
mais code toujours non valide.
Avatar
CrazyCat
Fulcanelli wrote:
Problème résolu avec cette page http://code.google.com/support/bin/answer.py?answere622&topic369
cela donne http://www.gael-raoux.fr/cartes/test_google_maps_mysql_5.php
mais code toujours non valide.



Ton code est non valide pour une raison simple: les & ne sont pas
encodés dans ton appel du javascript (il faut mettre &amp;)



--
Discussions et débats sur l'actualité: http://www.sujets-d-actu.eu
Réseau IRC Francophone: http://www.crazy-irc.net