geoPlugin Home

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.

If no populated place is found within a 10-mile radius of your given coordinates, the server will return null



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 47.6344/-122.3422 (you) is:

	 Place: Medina
Country Code: US
Region: Washington
Latitude: 47.6209300
Longitude: -122.2276200
Distance (miles): 5.42
Distance (km): 8.72


Nearby Places

Rather than give you the exact nearest populated place to a set of latitude/logitude coordinates, geoPlugin can reverse geocode an IP or 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 starting from an IP address, simply call:

http://www.geoplugin.net/extras/nearby.gp?ip=x.x.x.x


replace x.x.x.x with a valid IP address.

To find places nearby a geographical location starting from Latitude/Longitude values, simply call:

http://www.geoplugin.net/extras/nearby.gp?lat=XXX&long=YYY


replace XXX and YYY with the latitude and longitude values, respectively.

If no latitude or longitude values are set, then the lat/long values from PHP's $_SERVER['REMOTE_ADDR'] will be used, which may not be desirable



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




For PHP users, the PHP Class has nearby places all built in.



Nearby places to you include:

1:
Place: Medina
Region: Washington
Latitude: 47.6209300
Longitude: -122.2276200
Distance (miles): 5.42
Distance (km): 8.72
Direction (degrees) 96.05
Direction (heading) E
2:
Place: Bellevue
Region: Washington
Latitude: 47.6103800
Longitude: -122.2006800
Distance (miles): 6.8
Distance (km): 10.94
Direction (degrees) 98.98
Direction (heading) E
3:
Place: Kirkland
Region: Washington
Latitude: 47.6814900
Longitude: -122.2087400
Distance (miles): 7.01
Distance (km): 11.28
Direction (degrees) 65.79
Direction (heading) ENE
4:
Place: Mercer Island
Region: Washington
Latitude: 47.5706500
Longitude: -122.2220700
Distance (miles): 7.12
Distance (km): 11.46
Direction (degrees) 119.25
Direction (heading) ESE
5:
Place: Bainbridge Island
Region: Washington
Latitude: 47.6262100
Longitude: -122.5212400
Distance (miles): 8.36
Distance (km): 13.45
Direction (degrees) 90.49
Direction (heading) E




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 47.6344/-122.3422 (you) is:

	 Place: Seattle
Country Code: US
Post Code: 98109
Latitude: 47.6338997
Longitude: -122.3476028
Distance (miles): 0.25
Distance (km): 0.41
Confidence: 0


EU Cookie Law


If you or your organization are based in the European Union, or your website is intended for people located inside the European Union, and your website uses cookies, you are required by European law to inform your European visitors that your site uses cookies and require their consent before setting any cookies.

This is the so-called new “EU cookie law”.

If your visitor is outside the European Union, you are not required to ask for consent prior to setting cookies.

Use the CookieLaw geoPlugin Javascript extra to determine if your visitor is required to consent to setting cookies (ie the visitor comes from one of the 27 European countries).

The output from cookielaw.js is a Javascript function providing a Boolean true/false response allowing you to decide whether you need to ask permission from your visitor (true) or not (false) to set cookies.

<script src="http://www.geoplugin.net/extras/cookielaw.js" type="text/javascript"></script>


the output for you is:




See also

 
 
Bookmark with:    Digg    StumbleUpon    Del.icio.us    Technorati


Acceptable Use Policy    Contact geoPlugin