Hi

see http://daviestrachan.zxq.net/maps/stationmap5.php

The php file in this example uses has been modified to display the map
if no data is found in the database

This is the modified code that always returns XML located at the
location found by the geocoder indicating no record found

$result = mysql_query($query);
if (!$result) {
  die("Invalid query: " . mysql_error());
}

        header("Content-type: text/xml");
if (mysql_num_rows($result)==0)
        $node = $dom->createElement("marker");
                $newnode = $parnode->appendChild($node);
                $newnode->setAttribute("name", "No Records Found");
                $newnode->setAttribute("address","Centered on
Location);
                $newnode->setAttribute("lat", $center_lat);
                $newnode->setAttribute("lng", $center_lng);
                $newnode->setAttribute("distance", 0);

    else {
        // Iterate through the rows, adding XML nodes for each
                while ($row = @mysql_fetch_assoc($result)){
                $node = $dom->createElement("marker");
                $newnode = $parnode->appendChild($node);
                $newnode->setAttribute("name", $row['name']);
                $newnode->setAttribute("address", $row['address']);
                $newnode->setAttribute("lat", $row['lat']);
                $newnode->setAttribute("lng", $row['lng']);
                $newnode->setAttribute("distance", $row['distance']);
        }

}
It used a database of UK railway stations
Try paris 25mls   No record found centered on geolocation
Try paris 200 mls  This picks up UK stations within 200 miles of
paris

This technique will always produce a map unless there is a problem
with your database.
Try using phpMyAdmin with the following query
SELECT  name, lat, lng, ( 3959 * acos( cos( radians('55') ) *
cos( radians( lat ) ) * cos( radians( lng ) - radians('-4') ) +
sin( radians('55') ) * sin( radians( lat ) ) ) ) AS distance FROM
gbstn HAVING distance < '200' ORDER BY distance LIMIT 0 , 20

CHANGE 55(2 places) and -4 to your own lat lng AND gbstn to your own
table name

Regards Davie




On Nov 15, 3:33 am, "[email protected]" <[email protected]>
wrote:
> On Nov 14, 6:59 pm, mes421 <[email protected]> wrote:
>
>
>
>
>
>
>
>
>
> > Hey!  Thanks for the suggestions.  Since I've posted my comments I noticed
> > that there are 2 very similar links to this tutorial.   I've tried the
> > final store locator code on both,
>
> > a)http://code.google.com/apis/maps/articles/phpsqlsearch_v3.html,
>
> > b)http://code.google.com/apis/maps/articles/phpsqlsearch.html.
>
> > Regardless, I'm still dead in the water. I think the problem is with the
> > .php file called by the .html page.  Somehow the markers are not
> > being returned.
>
> > I'd like to hear from anyone that it really works.  The first day I worked
> > on this I kept getting xml errors and had issues with quotes (") vs. single
> > quotes (').
>
> > Thanks again, MES
>
> This 
> example:http://www.rentalmatch101.com.php5-20.dfw1-1.websitetestlink.com/goog...
>
> From this search of the 
> group:http://groups.google.com/group/google-maps-js-api-v3/search?q=store+l...
>
> Works.  I searched for Aurora, CO; distance 50 mi, 2 bedrooms, 2
> baths, min price 0, max price 2000+.
>
> I have seen lots of examples go by in the group that eventually
> worked.
>
>   -- Larry

-- 
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