On Aug 14, 4:56 pm, billy_111 <[email protected]> wrote:
>
> http://babiesinthecity.co.uk/test/?searchbutton=&search=M25
>
> Any ideas what i'm doing wrong?

You are searching *your* database for "M25" postcodes, and then
passing that "M25" to the directions service, which fails. The typical
successful XML file uses full postcodes. If you try with a postcode
district instead, which is what you do when you use GET[search] as the
origin, you get no results:

http://maps.google.com/maps/api/directions/xml?origin=M25&destination=M25+2SW&sensor=false

What that means is that you need to code more defensively. Accept a
full postcode in your URL, and use only the first part to search your
database. Then you can pass the full postcode to the directions
service. And, if the directions service returns no distance, code for
that possibility.

Note that the Terms of Service *require* you either to show the route
on a Google map or to show the textual directions, or both. Currently
it doesn't look like you're doing either. You could probably make use
of a small static map since you can include the encoded polyline in
the <img> tag in your HTML output. Or: if you can only use the first
part of the postcode, use a different geocoder API which can geocode
the postcode(s) and then find the straight-line distance. That will be
less accurate, but doesn't require you to display a map and since
you're guessing at where to measure from with "M25" anyway, accuracy
is less of an issue.

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