I have look at my logs and i can seen that some people have tried the
wrong address
http://sharplesenterprise.com.au/Gmaps3/markers
http://sharplesenterprise.com.au/Gmaps3/markerLocation

On Jul 8, 3:47 pm, sharples <[email protected]> wrote:
> sorry the link is to a different virsion of my map the post is 
> forhttp://sharplesenterprise.com.au/Gmaps3/MarkersLocation
>
> On Jul 8, 11:46 am, sharples <[email protected]> wrote:
>
> > Im using a mysql data base and php to query the database and the map
> > api to show the map with our stores within a certain radius of the
> > search location , with have two type of stores so i added a extra
> > field to the mysql table called type and assigned a red or blue marker
> > to the different stores ,
> > My php xml output has the store type so the page get a valid result
> > but it show red markers for all stores
> > so i think it is the javascript (api) that not working or wrong as the
> > php query works and the xml out put works
> > here are my files
>
> > ##### html java script #######################
>
> > <html xmlns="http://www.w3.org/1999/xhtml";>
> >   <head>
> >     <meta http-equiv="content-type" content="text/html; charset=utf-8"/
>
> >     <title>Markers.sharplesenterprise.com.au</title>
> >     <script src="http://maps.google.com/maps?file=api&v=2&key=@@@@@";
> >             type="text/javascript"></script>
>
> >     <script type="text/javascript">
>
> >         //<![CDATA[
> >         // set up two var's for the custom icons and download then --
> > fix download icons and save to disk stop downloads
> >         var iconBlue = new GIcon();
> >         iconBlue.image = 'http://labs.google.com/ridefinder/images/
> > mm_20_blue.png';
> >         iconBlue.shadow = 'http://labs.google.com/ridefinder/images/
> > mm_20_shadow.png';
> >         iconBlue.iconSize = new GSize(12, 20);
> >         iconBlue.shadowSize = new GSize(22, 20);
> >         iconBlue.iconAnchor = new GPoint(6, 20);
> >         iconBlue.infoWindowAnchor = new GPoint(5, 1);
>
> >         var iconRed = new GIcon();
> >         iconRed.image = 'http://labs.google.com/ridefinder/images/
> > mm_20_red.png';
> >         iconRed.shadow = 'http://labs.google.com/ridefinder/images/
> > mm_20_shadow.png';
> >         iconRed.iconSize = new GSize(12, 20);
> >         iconRed.shadowSize = new GSize(22, 20);
> >         iconRed.iconAnchor = new GPoint(6, 20);
> >         iconRed.infoWindowAnchor = new GPoint(5, 1);
>
> >         var customIcons = [];
> >    // var customIcons = ['type'];
> >         customIcons["Movingtogether"] = iconBlue;
> >         customIcons["Medicaltogether"] = iconRed;
>
> >         var map;
> >         var geocoder;
>
> >         //checks if browser is compatible eg. javascript, XHTML
> >         function load() {
> >             if (GBrowserIsCompatible()) {
> >                 geocoder = new GClientGeocoder();
> >                 map = new GMap2(document.getElementById('map'));
> >                 map.addControl(new GSmallMapControl());
> >                 map.addControl(new GMapTypeControl());
> >                 map.setCenter(new GLatLng(-33.894115, 151.266006), 4);
> >             }
> >         }
> >         //call search location method by looking up the location in
> > the text box and then GEOCoding the address for SQL query
> >         function searchLocations() {
> >             var address = document.getElementById
> > ('addressInput').value;
> >             geocoder.getLatLng(address, function(latlng) {
> >                 if (!latlng) {
> >                     alert(address + ' not found');
> >                 } else {
> >                     searchLocationsNear(latlng);
> >                 }
> >             });
> >         }
> >         //takes the values [lat-lng] returned by search location and
> > then run a query in the database to find
> >         //sites that are within a radius of the address passed to it.
> >         function searchLocationsNear(center) {
> >             var radius = document.getElementById
> > ('radiusSelect').value;
> >             var searchUrl = 'phpsqlsearch_genxml.php?lat=' + center.lat
> > () + '&lng=' + center.lng() + '&radius=' + radius;
> >             GDownloadUrl(searchUrl, function(data) {
> >                 var xml = GXml.parse(data);
> >                 var markers = xml.documentElement.getElementsByTagName
> > ('marker');
> >                 map.clearOverlays();
>
> >                 var sidebar = document.getElementById('sidebar');
> >                 sidebar.innerHTML = '';
> >                 if (markers.length == 0) {
> >                     sidebar.innerHTML = 'No results found.';
> >                     map.setCenter(new GLatLng(-33.894115, 151.266006),
> > 4);
> >                     return;
> >                 }
>
> >                 var bounds = new GLatLngBounds();
> >                 for (var i = 0; i < markers.length; i++) {
> >                     var name = markers[i].getAttribute('name');
> >                     var address = markers[i].getAttribute('address');
> >                     var type = markers[i].getAttribute('type');
> >                     var distance = parseFloat(markers[i].getAttribute
> > ('distance'));
> >                     var point = new GLatLng(parseFloat(markers
> > [i].getAttribute('lat')),
> >                                  parseFloat(markers[i].getAttribute
> > ('lng')));
>
> >                     var marker = createMarker(point, name, address,
> > type);
> >                     map.addOverlay(marker);
> >                     var sidebarEntry = createSidebarEntry(marker,
> > name, address, type, distance);
> >                     sidebar.appendChild(sidebarEntry);
> >                     bounds.extend(point);
> >                 }
> >                 map.setCenter(bounds.getCenter(),
> > map.getBoundsZoomLevel(bounds));
> >             });
> >         }
>
> >         function createMarker(point, name, address, type) {
> >             var marker = new GMarker(point, customIcons[type]);
> >             var html = '<b>' + name + '</b> <br/>' + address;
> >             GEvent.addListener(marker, 'click', function() {
> >                 marker.openInfoWindowHtml(html);
> >             });
> >             return marker;
> >         }
>
> >         function createSidebarEntry(marker, name, address, type,
> > distance) {
> >             var div = document.createElement('div');
> >             var html = '<b>' + name + '</b> (' + distance.toFixed(1) +
> > ')<br/>' + address;
> >             div.innerHTML = html;
> >             div.style.cursor = 'pointer';
> >             div.style.marginBottom = '5px';
> >             GEvent.addDomListener(div, 'click', function() {
> >                 GEvent.trigger(marker, 'click');
> >             });
> >             GEvent.addDomListener(div, 'mouseover', function() {
> >                 div.style.backgroundColor = '#eee';
> >             });
> >             GEvent.addDomListener(div, 'mouseout', function() {
> >                 div.style.backgroundColor = '#fff';
> >             });
> >             return div;
> >         }
> >         //]]>
>
> >   </script>
> >       <style type="text/css">
> >           #addressInput
> >           {
> >               width: 251px;
> >           }
> >       </style>
> >   </head>
> > <h1 style="text-align: center; color: #0000FF">Sharples Enterprise
> > Find Sites Near Location</h1>
> >   <body onload="load()" onunload="GUnload()">
>
> >     Address: <input type="text" id="addressInput"/>
>
> >     Radius: <select id="radiusSelect">
>
> >       <option value="5" selected>5</option>
> >       <option value="10">10</option>
> >       <option value="15">15</option>
> >       <option value="25">25</option>
> >       <option value="50">50</option>
> >       <option value="100">100</option>
> >       <option value="200">200</option>
>
> >     </select>
>
> >     <input type="button" onclick="searchLocations()" value="Search
> > Locations"/>
> >     <br/>
> >     <br/>
> > <div style="width:900px; font-family:Arial,
> > sans-serif; font-size:11px; border:1px solid black">
> >   <table>
> >     <tbody>
> >       <tr id="cm_mapTR">
>
> >         <td width="300" valign="top"> <div id="sidebar"
> > style="overflow: auto; height: 600px; font-size: 11px; color: #000"></
> > div>
>
> >         </td>
> >         <td> <div id="map" style="overflow: hidden; width:600px;
> > height:600px"></div> </td>
>
> >       </tr>
> >     </tbody>
> >   </table>
> > </div>
> >   </body>
> > </html>
>
> > #######################################################
> > php query make xml
> > ##################################################
>
> > <?php
> > require("phpsqlsearch_dbinfo.php");
>
> > // Get parameters from URL
> > $center_lat = $_GET["lat"];
> > $center_lng = $_GET["lng"];
> > $radius = $_GET["radius"];
>
> > // Start XML file, create parent node
> > $dom = new DOMDocument("1.0");
> > $node = $dom->createElement("markers");
> > $parnode = $dom->appendChild($node);
>
> > // Opens a connection to a mySQL server
> > $connection=mysql_connect (localhost, $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());
>
> > }
>
> > // Search the rows in the markers table
> > $query = sprintf("SELECT address, name, lat, lng, type, ( 3959 * acos
> > ( cos( radians('%s') ) * cos( radians( lat ) ) * cos( radians( lng ) -
> > radians('%s') ) + sin( radians('%s') ) * sin( radians( lat ) ) ) ) AS
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to