views:

1122

answers:

1

Hello. I am the owner of a business that is building a new website application. My partner is the programmer who is doing the development and neither one of us has any real in-depth experience with Google Map API or it's polyline/polygon area capabilities.

We need an easy way to capture inputs within our user admin area where our locations can enter their service coverage area info i.e. 1st street north of Jones blvd, or a 5 mile radius from the location address, etc. and have the Google Map API plot the polyline borders.

Then, visitors to our site need to be able to see this info when they view the google map for one of our locations and also see if their service address falls within that service area or not. We then need to set a flag somehow to trigger a notification to the visitor that their address is not eligible for service or delivery.

If anyone can assist us with this (example php code to interface with the suggested APIs would be preferred and ideal as we simply don't understand the complexities of the Google API, the polyline coordinate capture tool, etc), it would be greatly appreciated, as we have struggled to figure out how to create this in php and more importantly how to integrate it into our existing site.

Thank you in advance for your replies and assistance.

Sincerely,

Larry D Managing Director SunMark Ventures

Update: Thank you for your answer CodeMeIT...how do recommend we capture these longlats in our sql database...i.e. what is the field format or type and do we need to have separate fields for long and lat, and how can we standardize for all locations, i.e. how many long and lats are needed to create a polygon area, as we want to be able to have our location managers input this info for their own locations from their user login areas...

Thank you in advance for your assistance...greatly appreciated!

+3  A: 

Draw polygon on map

You can draw polygons that covering your service area on google map. Those polygons are defined by a set of latlongs that you can collect from a google earth and sasve them somewhere. Once you had all the coordinates that can cover your each service area, you can see the link to find out how to draw them on google map

Google Map polygons Sample

Check if user is within service area

If the user had address information entered or stored somewhere, you can take the address to google map geocoding service to find out the address's latitude and longitude.

Google MAP Geocoding Service API

After getting the address' coordinate, the code can check if the coordinateis within any bound of the polygons of your service area. If false, that is out of service area.

PHP for checking point in polygon

codemeit