Webservice Extras
The geoPlugin webservice extras build on the base webservices and are always being added to, based on your ideas and requests.
If you have any request for a webservice extras, please let us know and we'll do what we can to incorporate it.
Latitude/Longitude to Place
Not only can geoPlugin provide you with geolocation of IP addresses, but we can also reverse geocode any given latitude and longitude coordinates to a place.
This reverse geocoding allows you to specify the latitude and longitude coordinates and will output the nearest populated place in PHP, JSON, or XML formats.
To reverse geocode a latitude/longitude coordinate pair, simply call:
http://www.geoplugin.net/extras/location.gp?lat=XXX&long=YYY
replace XXX and YYY with the latitude and longitude values, respectively.
The default output is a PHP serialized array.
You can change the output by tagging on the format request variable as such:
For PHP:
http://www.geoplugin.net/extras/location.gp?lat=XXX&long=YYY&format=php
For JSON:
http://www.geoplugin.net/extras/location.gp?lat=XXX&long=YYY&format=json
For XML:
http://www.geoplugin.net/extras/location.gp?lat=XXX&long=YYY&format=xml
The location of 38/-97 (you) is:
Place: Potwin
Country Code: US
Region: Kansas
Latitude: 37.9719009
Longitude: -97.0006027
Distance (miles): 1.94
Distance (km): 3.12
Nearby Places
Rather than give you the exact nearest populated place to a set of latitude/logitude coordinates, geoPlugin can reverse geocode latitude and longitude values to provide you with any number of populated places nearby.
As with the base webservices, with the exception of Javascript (use JSON for that), places nearby can be output in PHP, JSON, or XML to suite your needs.
To find places nearby a geographical location, simply call:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY
replace XXX and YYY with the latitude and longitude values, respectively.
You can specify how many results to return by tagging on the limit variable eg
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&limit=10
to return a maximum of 10 results
Additionally, you can specify the radius (in miles) of the search for nearby places, by tagging on the radius variable eg
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&limit=10&radius=50
to return all nearby populated places within 50 miles of the given point.
The default output is a PHP serialized array.
You can change the output by tagging on the format request variable as such:
For PHP:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&format=php
For JSON:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&format=json
For XML:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY&format=xml
Latitude/Longitude to Postal Code
The reverse geocoding of a latitude/longitude coordinate pair to populated place given above uses a database of many millions of geospatial coordinates and is very well developed, especially for developed countries.
However, because of copyright and cost issues, we cannot provide postal codes (zip codes) for all of these places.
Nonetheless, we can provide reverse geocoding of latitude/longitude coordinate pairs to postal codes for about a million of these locations.
This post code web service can be accessed using:
http://www.geoplugin.net/extras/postalcode.gp?lat=XXX&long=YYY
To provide the nearest populated place with a post code within a 10-mile radius of your given coordinates.
Like always, the format= variable can be appended to specify PHP, JSON, or XML outputs.
The closest place with a post code we have on file for 38/-97 (you) is:
Place: Potwin
Country Code: US
Post Code: 67123
Latitude: 37.9719009
Longitude: -97.0006027
Distance (miles): 1.94
Distance (km): 3.12
Confidence: 0
See also
- In-depth User Guide
-
- geoPlugin webservice Extras
-
