Prevent non-specific address for geocoding?

129 views
Skip to first unread message

Beuy

unread,
Nov 25, 2010, 7:47:26 PM11/25/10
to Google Maps JavaScript API v3
I am working on a website that will allow customers to book a unique
limousine style vehicle, part of the booking process is to enter a
pickup and destination address. If possible I would like to validate
these addresses against Google maps to ensure accuracy and calculate
the distance between A and B. So far I have looked into the geocoding
examples but have run into the problem of users being able to input
very large regions such as major cities.

Is there a way to prevent non-specific addresses from being geocoded
or returning false? E.G I don't want users to be able to enter
"Brisbane" and get a successful geocode result.

If there is a better way to achieve this please let me know.

Chris Broadfoot

unread,
Nov 26, 2010, 1:35:54 AM11/26/10
to google-map...@googlegroups.com
http://code.google.com/apis/maps/documentation/javascript/reference.html#GeocoderResult

check the 'types' field for 'street_address'

Example:

vs
Chris


--
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 google-map...@googlegroups.com.
To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.


JKurtock

unread,
Nov 26, 2010, 12:32:15 PM11/26/10
to Google Maps JavaScript API v3
You might also want to look at LocationType
http://code.google.com/apis/maps/documentation/javascript/reference.html#GeocoderLocationType

Do run some test cases; I've noticed that when a valid apartment
address is included with the address, the GeoCoder returns
LocationType "approximate." The same address with the apartment
number omitted returns "rooftop."

A non-valid address can return "Range-Interpolated" (if 123 Main St.
existed, it would be "here"). But some valid addresses can return
either Range-Interpolated or Approximate (possibly because the
location is obscured by trees??)

The US post office can validate addresses via their website. You
might check your local post office for something similar.

On Nov 25, 10:35 pm, Chris Broadfoot <c...@google.com> wrote:
> http://code.google.com/apis/maps/documentation/javascript/reference.h...
>
> check the 'types' field for 'street_address'
>
> Example:
>
> http://maps.googleapis.com/maps/api/geocode/json?address=sydney&senso...
> vshttp://maps.googleapis.com/maps/api/geocode/json?address=48+pirrama+r...
>
> Chris
>
>
>
>
>
>
>
> On Fri, Nov 26, 2010 at 11:47 AM, Beuy <p.ship...@gmail.com> wrote:
> > I am working on a website that will allow customers to book a unique
> > limousine style vehicle, part of the booking process is to enter a
> > pickup and destination address. If possible I would like to validate
> > these addresses against Google maps to ensure accuracy and calculate
> > the distance between A and B. So far I have looked into the geocoding
> > examples but have run into the problem of users being able to input
> > very large regions such as major cities.
>
> > Is there a way to prevent non-specific addresses from being geocoded
> > or returning false? E.G I don't want users to be able to enter
> > "Brisbane" and get a successful geocode result.
>
> > If there is a better way to achieve this please let me know.
>
> > --
> > 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
> > google-map...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-maps-js-a...@googlegroups.com<google-maps-js-api-v3%2B unsub...@googlegroups.com>
> > .

Beuy

unread,
Dec 1, 2010, 11:59:40 PM12/1/10
to Google Maps JavaScript API v3
Great! Just what I needed. Thank you for the advice about not relying
on this too much, unfourtanlty there is no freely provided service
from Australia Post to validate street addresses. I'll just be using
the returned gmap results as a rough guide.

On Nov 27, 3:32 am, JKurtock <jkurt...@gmail.com> wrote:
> You might also want to look at LocationTypehttp://code.google.com/apis/maps/documentation/javascript/reference.h...
Reply all
Reply to author
Forward
0 new messages