Saturday, 14 September 2013

Best way to detect when shipments are out-of-range - relevant to canada

Best way to detect when shipments are out-of-range - relevant to canada

I've built a simple ecommerce shopping cart. The client wants to only
allow deliveries within Toronto and certain surrounding areas (etobicoke
region, scarborough region, and north york region, but NOT thornhill
region or vaughn region).
My question is what is the proper way to detect whether deliveries are or
are not within these regions? I am using Google Maps to geocode the
shipping address, then using haversine formula to detect the linear
distance between shipping source and shipping destination, but this isn't
doesn't actually help me with detecting "regions".
In canada we have postal codes. Do I basically need to have a postal code
dictionary and do a look up? Is there a better way to do this
programmatically?

No comments:

Post a Comment