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 38.658199/-77.249702 (you) is:

	 Place: Dale City
Country Code: US
Region: Virginia
Latitude: 38.6370600
Longitude: -77.3110900
Distance (miles): 3.62
Distance (km): 5.83


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: Dale City
Region: Virginia
Latitude: 38.6370600
Longitude: -77.3110900
Distance (miles): 3.62
Distance (km): 5.83
Direction (degrees) 119.14
Direction (heading) ESE
2:
Place: Fort Belvoir
Region: Virginia
Latitude: 38.7119000
Longitude: -77.1458900
Distance (miles): 6.72
Distance (km): 10.81
Direction (degrees) 44.41
Direction (heading) NE
3:
Place: Burke
Region: Virginia
Latitude: 38.7934500
Longitude: -77.2716500
Distance (miles): 9.42
Distance (km): 15.16
Direction (degrees) 4.27
Direction (heading)
4:
Place: Springfield
Region: Virginia
Latitude: 38.7892800
Longitude: -77.1872000
Distance (miles): 9.66
Distance (km): 15.55
Direction (degrees) 12.39
Direction (heading) NNE
5:
Place: Franconia
Region: Virginia
Latitude: 38.7820600
Longitude: -77.1463700
Distance (miles): 10.21
Distance (km): 16.43
Direction (degrees) 21.05
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 38.658199/-77.249702 (you) is:

	 Place: Occoquan
Country Code: US
Post Code: 22125
Latitude: 38.6815987
Longitude: -77.2604980
Distance (miles): 1.72
Distance (km): 2.77
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