Module egg_mode::place [] [src]

Types and methods for looking up locations.

Location search for Twitter works in one of two ways. The most direct method is to take a latitude/longitude coordinate (say, from a devide's GPS system or by geolocating from wi-fi networks, or simply from a known coordinate) and call reverse_geocode. Twitter says reverse_geocode provides more of a "raw data access", and it can be considered to merely show what locations are in that point or area.

On the other hand, if you're intending to let a user select from a list of locations, you can use the search_* methods instead. These have much of the same available parameters, but will "potentially re-order [results] with regards to the user who is authenticated." In addition, the results may potentially pull in "nearby" results to allow for a more broad selection or to account for inaccurate location reporting.

Since there are several optional parameters to both query methods, each one is assembled as a builder. You can create the builder with the reverse_geocode, search_point, search_query, or search_ip functions. From there, add any additional parameters by chaining method calls onto the builder. When you're ready to peform the search call, hand your tokens to call, and the list of results will be returned.

Along with the list of place results, Twitter also returns the full search URL. egg-mode returns this URL as part of the result struct, allowing you to perform the same search using the reverse_geocode_url or search_url functions.

Structs

GeocodeBuilder

Represents a reverse_geocode query before it is sent.

Place

Represents a named location.

SearchBuilder

Represents a location search query before it is sent.

SearchResult

Represents the result of a location search, either via reverse_geocode or search.

Enums

Accuracy

Represents the accuracy of a GPS measurement, when being given to a location search.

PlaceType

Represents the type of region represented by a given place.

Functions

reverse_geocode

Begins building a reverse-geocode search with the given coordinate.

reverse_geocode_url

From a URL given with the result of reverse_geocode, perform the same reverse-geocode search.

search_ip

Begins building a location search via an IP address.

search_point

Begins building a location search via latitude/longitude.

search_query

Begins building a location search via a text query.

search_url

From a URL given with the result of any search_* function, perform the same location search.

show

Load the place with the given ID.