2

I have a form where I receive the latitude,longitude values of a location.On submitting the form, I wish to create geofence in google maps of a static radius.I dont wish to draw the geofence using drawing tool directly.Can anyone suggest me a way as to how I can pass the values from the form to the map?

Sohel Khan A
  • 59
  • 1
  • 1
  • 5
  • 2
    Can you post some code? It might help give us a better idea of the context you're working in (e.g. how is java involved?). – khriskooper Jul 06 '15 at 13:10
  • Hi khris, I have created a HTML Form in which i get the latitude and longitude from google address autocomplete feature.With these values ,when I click on button,it should create a geofence on the map with a static radius.Regarding how java is involved,it was a mistake from my side for adding java as a tag. My apologies. – Sohel Khan A Jul 06 '15 at 14:01
  • Do you need to use geofencing (which is deprecated), or can you just draw circles using the newer Google Maps API instead? – khriskooper Jul 06 '15 at 14:55

1 Answers1

3

As geofencing is deprecated I think it's best to use the new API.

I've created a Liveweave example of how to achieve something along these lines here.

You'll have to obtain the latitude / longtitude values from the URL of page shown after submitting the form. A good way to achieve this is demonstrated here.

khriskooper
  • 767
  • 8
  • 18
  • Hi Khris,Thanks for your idea.I am able to draw a circle.The whole purpose behind this requirement is to monitor inward and outward movement of vehicles to the circle.But after creating a circle,I am not able to check whether I am outside or inside the circle with a simple click event because I dont have the circle's coordinates to check as in a polygon.Is there something similar to containsLocation() as in polygon for circle. Any help would be appreciated.. – Sohel Khan A Jul 08 '15 at 06:35
  • OK, I think I understand your problem now. Well, if you know the centre coordinates of the circle, and the circle's radius, then you can figure our whether another coordinate (vehicle) is inside the circle or not by using this accepted function: http://stackoverflow.com/questions/14598426/how-to-detect-if-a-point-is-in-a-circle – khriskooper Jul 08 '15 at 14:47
  • I've modified and created a new Liveweave example here: http://liveweave.com/00nMdZ. If you comment out the 3rd line, you will see the circle change color to indicate a vehicle is outside of the circle. – khriskooper Jul 08 '15 at 14:58
  • Thanks a lot KhrisKooper .....It worked like charm....thanks for your support throughout .... – Sohel Khan A Jul 14 '15 at 06:25