0

I have

  1. latitude/longitude of particular state
  2. latitude/longitude of particular suburb

What I want :

I want to know

  1. Area of particular state
  2. particular suburb lie in which state

What I already tried :

  1. How do I check if a longitude/latitude point is within a range of coordinates? -> But unfortunately not getting in php
  2. https://developers.google.com/maps/documentation/geocoding/#ReverseGeocoding
Community
  • 1
  • 1
chetanspeed511987
  • 1,995
  • 2
  • 22
  • 34

1 Answers1

1

you can use my Lib class and behavior to geocode the two things: http://www.dereuromark.de/2012/06/12/geocoding-with-cakephp/

then you got coordinates for both of them and you can use this information to get your results.

so

  • add lat/lng fields to your tables (states and suburbs)
  • run a save() for each of them to geocode the address field (name probably here)
  • use the now stored lat/lng fields to determine distances etc

PS: you will most likely get geocoding results that will already tell you which state the suburb is located in. so you might want to extract this information along the way. this will be more accurate then trying to use distances, especially in smaller states the distance can get you a wrong result.

mark
  • 21,691
  • 3
  • 49
  • 71
  • Do you have this plugin in cakephp1.3? – chetanspeed511987 Dec 12 '12 at 06:12
  • Hello mark,I am not able use distance for my scenario. I want just check particular lat/lng of suberbs or city lies in perticular city or state. – chetanspeed511987 Dec 12 '12 at 07:17
  • 1
    you might still be able to use the verbose response of the google Geocoding API here. try it out. PS: that is why you ALWAYS need to submit the cakephp version you are working with! https://github.com/dereuromark/tools/tree/1.3 – mark Dec 12 '12 at 09:49