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?

Thanks!!
LVL 4
zack4x4Asked:
Who is Participating?
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?
0
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 (client.lat > rect[south].lat and 
    client.lat < rect[north].lat and 
    client.lng > rect[west].lng and 
    client.lng < rect[east]lng) Then
   // This rectangle is a match
  endif
endforeach

Open in new window

0

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!
0
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
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.