10 defined(
'JPATH_PLATFORM') or die();
30 public function getPlace($id)
33 $this->checkRateLimit(
'geo',
'id/:place_id');
36 $path =
'/geo/id/' . $id .
'.json';
39 return $this->sendRequest($path);
58 public function getGeocode($lat, $long, $accuracy = null, $granularity = null, $max_results = 0, $callback = null)
61 $this->checkRateLimit(
'geo',
'reverse_geocode');
64 $path =
'/geo/reverse_geocode.json';
68 $data[
'long'] = $long;
73 $data[
'accuracy'] = $accuracy;
79 $data[
'granularity'] = $granularity;
85 $data[
'max_results'] = $max_results;
91 $data[
'callback'] = $callback;
95 return $this->sendRequest($path,
'GET', $data);
120 public function search($lat = null, $long = null, $query = null, $ip = null, $granularity = null, $accuracy = null, $max_results = 0,
121 $within = null, $attribute = null, $callback = null)
124 $this->checkRateLimit(
'geo',
'search');
127 $path =
'/geo/search.json';
130 if ($lat == null && $long == null && $ip == null && $query == null)
132 throw new RuntimeException(
'At least one of the following parameters must be provided: lat, long, ip, or query.');
144 $data[
'long'] = $long;
150 $data[
'query'] = rawurlencode($query);
162 $data[
'granularity'] = $granularity;
168 $data[
'accuracy'] = $accuracy;
174 $data[
'max_results'] = $max_results;
180 $data[
'contained_within'] = $within;
186 $data[
'attribute:street_address'] = rawurlencode($attribute);
192 $data[
'callback'] = $callback;
196 return $this->sendRequest($path,
'GET', $data);
213 public function getSimilarPlaces($lat, $long, $name, $within = null, $attribute = null, $callback = null)
216 $this->checkRateLimit(
'geo',
'similar_places');
219 $path =
'/geo/similar_places.json';
222 $data[
'long'] = $long;
223 $data[
'name'] = rawurlencode($name);
228 $data[
'contained_within'] = $within;
234 $data[
'attribute:street_address'] = rawurlencode($attribute);
240 $data[
'callback'] = $callback;
244 return $this->sendRequest($path,
'GET', $data);
262 public function createPlace($lat, $long, $name, $geo_token, $within, $attribute = null, $callback = null)
265 $this->checkRateLimit(
'geo',
'place');
268 $data[
'long'] = $long;
269 $data[
'name'] = rawurlencode($name);
270 $data[
'token'] = $geo_token;
271 $data[
'contained_within'] = $within;
276 $data[
'attribute:street_address'] = rawurlencode($attribute);
282 $data[
'callback'] = $callback;
286 $path =
'/geo/place.json';
289 return $this->sendRequest($path,
'POST', $data);