Google Geotagging and drawing on a map

Hi - I have a google map with multiple rectangles on it for different delivery zones.  Once a user enters his address I want to be able to use the google api to display the map where his location is and determine how much the delivery fee is based on the zones that are already defined by the rectangles?  I was wondering how I would go about doing that?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
That is a great question.  How are you building the Google Map with the zones?
Julian HansenCommented:
So if I understand you correctly you have the following

1. Several Google layers defining rectangles with know co-ordinates
2. The co-ordinates of the client

Seems to me to be a simple bounding problem - you want to find what the smallest rectangle is that contains the client's lat/lng point?

How is your data stored - array / db?

Principle is to check for each rectangle (starting with the smallest)
foreach(rect in rectangles) do
  if ( > rect[south].lat and < rect[north].lat and 
    client.lng > rect[west].lng and 
    client.lng < rect[east]lng) Then
   // This rectangle is a match

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zack4x4Author Commented:
I ended up subcontracting it out to have the API built, don't have time to learn Google lol.  Thanks for your help!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.