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 39.043701/-77.487503 (you) is:

	 Place: Dulles Town Center
Country Code: US
Region: Virginia
Latitude: 39.0376100
Longitude: -77.4158200
Distance (miles): 3.87
Distance (km): 6.23


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.

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: Dulles Town Center
Region: Virginia
Latitude: 39.0376100
Longitude: -77.4158200
Distance (miles): 3.87
Distance (km): 6.23
Direction (degrees) 108.49
Direction (heading) ESE
2:
Place: Sterling
Region: Virginia
Latitude: 39.0062200
Longitude: -77.4286000
Distance (miles): 4.09
Distance (km): 6.58
Direction (degrees) 157.49
Direction (heading) SSE
3:
Place: Herndon
Region: Virginia
Latitude: 38.9695500
Longitude: -77.3861000
Distance (miles): 7.48
Distance (km): 12.03
Direction (degrees) 157.58
Direction (heading) SSE
4:
Place: Reston
Region: Virginia
Latitude: 38.9687200
Longitude: -77.3411000
Distance (miles): 9.41
Distance (km): 15.15
Direction (degrees) 148.93
Direction (heading) SSE
5:
Place: Hamilton
Region: Virginia
Latitude: 39.1342700
Longitude: -77.6624900
Distance (miles): 11.28
Distance (km): 18.15
Direction (degrees) 14.29
Direction (heading) NNE




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 39.043701/-77.487503 (you) is:

	 Place: Ashburn
Country Code: US
Post Code: 20147
Latitude: 39.0373001
Longitude: -77.4804993
Distance (miles): 0.58
Distance (km): 0.93
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