Search by proximity [closed]

4

I'm looking for tutorials to help me implement a search for proximity (like this link: link ). Note that in addition to its location it uses other filters (select and checkbox). Well, my strong is front-end, but I've already started learning PHP and mySQL.

How do I get to this result? What kind of tutorials should I look for? What languages are used? Anything you can clarify me about it would be great.

Thank you in advance.

    
asked by anonymous 11.09.2015 / 04:04

1 answer

1

In PHP it's basically this:

   public function getGeocodeAddress($lat, $long)
        {
            $url = "https://maps-api-ssl.google.com/maps/api/geocode/json?latlng=" . $lat . "," . $long . "&sensor=true";

            $data = @file_get_contents($url);
            $jsondata = json_decode($data, true);
            if (is_array($jsondata) && $jsondata['status'] == "OK") {
                $addressComponents = $jsondata['results'];
                for ($i = 0; $i < count($addressComponents); $i++) {
                    for ($j = 0; $j < count($addressComponents[$i]['address_components']); $j++) {
                        $typeName = $addressComponents[$i]['address_components'][$j]['types'][0];
                        if ('locality' == $typeName) {
                            return strtolower($addressComponents[$i]['address_components'][$j]['long_name']);
                        }
                    }
                }
            }
            return null;
        }

Look here for the exit: link

    
11.09.2015 / 05:40