thank you Pil

I display in my page dynamically city by city. for example if you
click on Paris will be a map of Paris, but if you zoom out you see the
other markers.

if you zoom out again you  can see the 9000 markers for France.

is what it is possible to change my script to only show markers
selected area ( while using a php / mysql )

thank



On 24 juil, 13:40, Pil <[email protected]> wrote:
> Assuming that all should work as expected in every supported browser,
> there is only one advisable suggestion:
>
> Limit your initially loaded markers to 300 or lesser.
> No one can overlook 9000 markers. Even Firefox users will be thankful
> for the limitations.
>
> On Jul 24, 12:01 pm, serna <[email protected]> wrote:
>
> > Hello,
>
> > sorry for my bad english
>
> > i make a page in localhost with "Using PHP/MySQL with Google Maps"
>
> >http://code.google.com/intl/fr/apis/maps/articles/phpsqlajax_v3.html
>
> > it's work fine but when i have over 9000 locations it' not work on
> > explorer ( 7 or 8)  but it's work on firework
>
> > in explorer i have message
> > "a script on this page may slow the execution "
>
> > when i have only 300 locations  its work on explorer
>
> > the script
>
> > <script src="http://maps.google.com/maps/api/js?sensor=false";
> >             type="text/javascript"></script>
> > <script type="text/javascript" src="js/jquery.js"></script>
> > <script type="text/javascript" src="http://gmaps-utility-
> > library.googlecode.com/svn/trunk/markermanager/release/src/
> > markermanager.js"></script>
>
> > <script type="text/javascript" >
> >     //<![CDATA[
>
> >     var customIcons = {
> >       "restaurants": {
> >         icon: 'http://localhost/totos_france/image/icon_map/
> > restaurant.png',
> >         shadow: 'http://labs.google.com/ridefinder/images/
> > mm_20_shadow.png'
> >       },
> >       bar: {
> >         icon: 'http://labs.google.com/ridefinder/images/
> > mm_20_red.png',
> >         shadow: 'http://labs.google.com/ridefinder/images/
> > mm_20_shadow.png'
> >       }
> >     };
>
> >     function load() {
> >       var map = new
> > google.maps.Map(document.getElementById("EmplacementDeMaCarte"), {
> >         center: new google.maps.LatLng(<?php echo $latit ; ?>, <?php
> > echo $longit ; ?>),
> >         zoom: <?php echo $zoom ; ?>,
> >         mapTypeId: 'roadmap'
> >       });
> >       var infoWindow = new google.maps.InfoWindow;
>
> >       // Change this depending on the name of your PHP file
> >       downloadUrl("phpsqlajax_genxml_toto.php", function(data) {
> >         var xml = data.responseXML;
> >         var markers =
> > xml.documentElement.getElementsByTagName("marker");
> >         for (var i = 0; i < markers.length; i++) {
> >                         var name = markers[i].getAttribute("name");
> >           var address = markers[i].getAttribute("address");
> >                         var addresstoto = 
> > markers[i].getAttribute("addresstoto");
> >                   var cptoto = markers[i].getAttribute("cptoto");
> >                    var teltoto = markers[i].getAttribute("teltoto");
> >             var type = markers[i].getAttribute("typeresto");
> >           var point = new google.maps.LatLng(
> >               parseFloat(markers[i].getAttribute("lat")),
> >               parseFloat(markers[i].getAttribute("lng")));
> >            var html = "<span class=\"textebullgras\">" + name + "</
> > span> <br/> <span class=\"textebullnormal\">" + address + " <br/> " +
> > addresstoto + " " + cptoto + "<br/>" + teltoto  ;
> >           var icon = customIcons[type] || {};
> >           var marker = new google.maps.Marker({
> >             map: map,
> >             position: point,
> >             icon: icon.icon,
> >             shadow: icon.shadow
> >           });
> >           bindInfoWindow(marker, map, infoWindow, html);
>
> >         }
> >       });
> >     }
>
> >     function bindInfoWindow(marker, map, infoWindow, html) {
> >       google.maps.event.addListener(marker, 'click', function() {
> >         infoWindow.setContent(html);
> >         infoWindow.open(map, marker);
> >       });
> >     }
>
> >     function downloadUrl(url, callback) {
> >       var request = window.ActiveXObject ?
> >           new ActiveXObject('Microsoft.XMLHTTP') :
> >           new XMLHttpRequest;
>
> >       request.onreadystatechange = function() {
> >         if (request.readyState == 4) {
> >           request.onreadystatechange = doNothing;
> >           callback(request, request.status);
> >         }
> >       };
>
> >       request.open('GET', url, true);
> >       request.send(null);
> >     }
>
> >     function doNothing() {}
>
> >     //]]>
> > </script>
>
> > and
>
> > <?php
> > require("phpsqlajax_dbinfo.php");
>
> > function parseToXML($htmlStr)
> > {
> > $xmlStr=str_replace('<','<',$htmlStr);
> > $xmlStr=str_replace('>','>',$xmlStr);
> > $xmlStr=str_replace('"','"',$xmlStr);
> > $xmlStr=str_replace("'",''',$xmlStr);
> > $xmlStr=str_replace("&",'&',$xmlStr);
> > $xmlStr=str_replace("é",'é',$xmlStr);
> > $xmlStr=str_replace("è",'è',$xmlStr);
> > return $xmlStr;
>
> > }
>
> > // Opens a connection to a MySQL server
> > $connection=mysql_connect ($host, $username, $password);
> > if (!$connection) {
> >   die('Not connected : ' . mysql_error());
>
> > }
>
> > // Set the active MySQL database
> > $db_selected = mysql_select_db($database, $connection);
> > if (!$db_selected) {
> >   die ('Can\'t use db : ' . mysql_error());
>
> > }
>
> > // Select all the rows in the markers table
> > $query = "SELECT * FROM table_toto WHERE 1";
> > $result = mysql_query($query);
>
> > if (!$result) {
> >   die('Invalid query: ' . mysql_error());
>
> > }
>
> > header("Content-type: text/xml");
>
> > // Start XML file, echo parent node
> > echo '<markers>';
>
> > // Iterate through the rows, printing XML nodes for each
> > while ($row = @mysql_fetch_assoc($result)){
> >   // ADD TO XML DOCUMENT NODE
> >   echo '<marker ';
> >   echo 'name="' . utf8_encode($row['nom_toto']) . '" ';
> >   echo 'address="' . utf8_encode($row['adresse_toto']) . '" ';
> >   echo 'addresstoto="' . utf8_encode($row['ville_toto']) . '" ';
> >   echo 'cptoto="' . $row['cp_resto'] . '" ';
> >   echo 'teltoto="' . $row['tel_resto'] . '" ';
> >   echo 'lat="' . $row['lat_resto'] . '" ';
> >   echo 'lng="' . $row['lng_resto'] . '" ';
> >   echo 'typeresto="' . utf8_encode($row['categorie_toto']) . '" ';
> >   echo '/>';
>
> > }
>
> > // End XML file
> > echo '</markers>';
>
> > ?>
>
> > thank you for help
>
> > Serna from France

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to