Webservice Extras
The geoPlugin webservice extras builds 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.
Much of these data are provided by geonames and are provided under the Creative Commons 4.0 license. Use of these data we provide mean you agree to abide by the CC4 license.
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, XML, or CSV formats.
To reverse geocode a latitude/longitude coordinate pair, simply call:
http://www.geoplugin.net/extras/location.gp?lat=XXX&lon=YYY
replace XXX and YYY with the latitude and longitude values, respectively.
If no lat/lon values are provided, lookup is based on the referring IP.
If you wish to reverse geocode an IP to place, use:
http://www.geoplugin.net/extras/location.gp?ip=xx.xx.xx.xx
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&lon=YYY&format=php
For JSON:
http://www.geoplugin.net/extras/location.gp?lat=XXX&lon=YYY&format=json
For XML:
http://www.geoplugin.net/extras/location.gp?lat=XXX&lon=YYY&format=xml
Place to Latitude/Longitude
Rather than reverse geocoding of latitude/longitude to place, geoPlugin can forward geocode a place to it's latitude longitude coordinates.
This forward geocoding allows you to specify the place and the country to output the lat/lon values (and more) in PHP, JSON, XML, or CSV formats.
To forward geocode a place to a latitude/longitude coordinate pair, simply call:
http://www.geoplugin.net/extras/forward_place.gp?place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
the 'country' GET variable is a two-letter ISO 3166 country code - see https://www.geoplugin.com/iso3166
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/forward_place.gp?format=php&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
For JSON:
http://www.geoplugin.net/extras/forward_place.gp?format=json&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
For XML:
http://www.geoplugin.net/extras/forward_place.gp?format=xml&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
Forward geocoding your place (Ashburn, US) gives:
1:
geoplugin_latitude: 39.0437200
geoplugin_longitude: -77.4874900
geoplugin_place: Ashburn
geoplugin_region: Virginia
geoplugin_regionCode: VA
geoplugin_countryCode: US
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&lon=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&lon=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&lon=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&lon=YYY&format=php
For JSON:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&lon=YYY&format=json
For XML:
http://www.geoplugin.net/extras/nearby.gp?lat=XXX&lon=YYY&format=xml
Nearby places to you include:
1:
Place: Ashburn
Region: Virginia
Latitude: 39.0437200
Longitude: -77.4874900
Distance (miles): 0.27
Distance (km): 0.43
Direction (degrees) 168.79
Direction (heading) S
2:
Place: Dulles Town Center
Region: Virginia
Latitude: 39.0376100
Longitude: -77.4158200
Distance (miles): 4.05
Distance (km): 6.51
Direction (degrees) 116.84
Direction (heading) ESE
3:
Place: Sterling
Region: Virginia
Latitude: 39.0062200
Longitude: -77.4286000
Distance (miles): 4.34
Distance (km): 6.99
Direction (degrees) 158.2
Direction (heading) SSE
4:
Place: Herndon
Region: Virginia
Latitude: 38.9695500
Longitude: -77.3861000
Distance (miles): 7.74
Distance (km): 12.45
Direction (degrees) 157.88
Direction (heading) SSE
5:
Place: Poolesville
Region: Maryland
Latitude: 39.1459400
Longitude: -77.4169300
Distance (miles): 7.89
Distance (km): 12.7
Direction (degrees) 5.22
Direction (heading)
Nearest Transport
A new addition to the reverse geocoding extras is the ability to find the nearest transport hub to an IP or lat/lon coordinates.
We have thousands of main airport hubs in our database and for Europe, many thousands of train stations.
For the rest of the world, we have train stations, but this isn't complete. If you know of a train station database for your country, drop us a line and we'll try add it.
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 the nearest transport hub to a an IP address, simply call:
http://www.geoplugin.net/extras/transport.gp?ip=x.x.x.x
replace x.x.x.x with a valid IP address. If no IP is given, the requesting IP is used like for all API requests.
To find the nearest transport hub to starting from Latitude/Longitude values, simply call:
http://www.geoplugin.net/extras/transport.gp?lat=XXX&lon=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/transport.gp?ip=x.x.x.x&format=php http://www.geoplugin.net/extras/transport.gp?lat=XXX&lon=YYY&format=php
For JSON:
http://www.geoplugin.net/extras/transport.gp?ip=x.x.x.x&format=json http://www.geoplugin.net/extras/transport.gp?lat=XXX&lon=YYY&format=json
For XML:
http://www.geoplugin.net/extras/transport.gp?ip=x.x.x.x&format=xml http://www.geoplugin.net/extras/transport.gp?lat=XXX&lon=YYY&format=xml
By default, only airports are returned (for which we have the most data).
If you want other transport hubs, tag on the type request variable as such:
“type” options:
- type=airport (Airports: Default)
- type=station (Stations)
- type=port (Maritime ports)
- type=all (All the above from nearest to furthest)
example:
http://www.geoplugin.net/extras/transport.gp?ip=x.x.x.x&format=json&type=station
For default airports, the top 5 results for you would be:
Nearest Airports to you include:
1:
geoplugin_type: airport
geoplugin_name: Washington Dulles International Airport
geoplugin_city: Washington
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: IAD
geoplugin_ICAO: KIAD
geoplugin_latitude: 38.9445000
geoplugin_longitude: -77.4558029
geoplugin_distanceMiles: 7.31
geoplugin_distanceKilometers: 11.77
geoplugin_directionAngle: 173.83
geoplugin_directionHeading: S
2:
geoplugin_type: airport
geoplugin_name: Ronald Reagan Washington National Airport
geoplugin_city: Washington
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: DCA
geoplugin_ICAO: KDCA
geoplugin_latitude: 38.8521000
geoplugin_longitude: -77.0376970
geoplugin_distanceMiles: 27.79
geoplugin_distanceKilometers: 44.73
geoplugin_directionAngle: 130.9
geoplugin_directionHeading: SE
3:
geoplugin_type: airport
geoplugin_name: Baltimore/Washington International Thurgood Marshall Airport
geoplugin_city: Baltimore
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: BWI
geoplugin_ICAO: KBWI
geoplugin_latitude: 39.1754000
geoplugin_longitude: -76.6682970
geoplugin_distanceMiles: 44.95
geoplugin_distanceKilometers: 72.34
geoplugin_directionAngle: 23.69
geoplugin_directionHeading: NNE
4:
geoplugin_type: airport
geoplugin_name: Helicopter Applicators Inc Heliport
geoplugin_city: Gettysburg
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA:
geoplugin_ICAO: 12PA
geoplugin_latitude: 39.8495000
geoplugin_longitude: -77.1841670
geoplugin_distanceMiles: 57.81
geoplugin_distanceKilometers: 93.03
geoplugin_directionAngle: 13.37
geoplugin_directionHeading: NNE
5:
geoplugin_type: airport
geoplugin_name: Charlottesville Albemarle Airport
geoplugin_city: Charlottesville
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: CHO
geoplugin_ICAO: KCHO
geoplugin_latitude: 38.1385994
geoplugin_longitude: -78.4529037
geoplugin_distanceMiles: 81.49
geoplugin_distanceKilometers: 131.14
geoplugin_directionAngle: 118.91
geoplugin_directionHeading: ESE
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&lon=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.0469/-77.4903 (you) is:
Place: Ashburn
Country Code: US
Post Code: 20147
Latitude: 39.0373001
Longitude: -77.4804993
Distance (miles): 0.85
Distance (km): 1.36
Confidence: 0
Postal Code to Latitude/Longitude
Rather than reverse geocoding of latitude/longitude to a Postal Code, geoPlugin can forward geocode a postcode to it's latitude longitude coordinates.
This forward geocoding allows you to specify the postcode and the country to output the lat/lon values (and more) in PHP, JSON, XML, or CSV formats.
To forward geocode a postcode to a latitude/longitude coordinate pair, simply call:
http://www.geoplugin.net/extras/forward_postcode.gp?place={URL-Encoded Postcode}&country={ISO 3166 2-letter Country Code}
the 'country' GET variable is a two-letter ISO 3166 country code - see https://www.geoplugin.com/iso3166
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/forward_place.gp?format=php&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
For JSON:
http://www.geoplugin.net/extras/forward_place.gp?format=json&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
For XML:
http://www.geoplugin.net/extras/forward_place.gp?format=xml&place={URL-Encoded-ASCII-Place}&country={ISO 3166 2-letter Country Code}
From your IP (3.236.86.184), we found the closest Postal Code (20147), which forward geocodes to:
Post Code: 20147
Latitude: 39.037300
Longitude: -77.480499
Place: Ashburn
County: Loudoun
Region: Virginia
Region Code: VA
Country Code: US
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:
GDPR
The General Data Protection Regulation (GDPR) (EU) is a regulation in EU law on data protection and privacy for all individuals within the European Union (EU) and the European Economic Area (EEA).
The GDPR contains provisions and requirements pertaining to the processing of personally identifiable information of individuals inside the European Union, and applies to all enterprises, regardless of location, that are doing business with the European Economic Area.
A processor of personal data must clearly disclose any data collection, declare the lawful basis and purpose for data processing, how long data is being retained, and if it is being shared with any third-parties or outside of the EU. This is outlined in our Privacy Policy and User agreement that you abide to by using any of geoPlugin's web services.
All main geoPlugin IP geolocation webservices identify whether the person is protected by GDPR by the variable geoplugin_inEU. If the value is 1, then you must apply the EU GDPR protection rule. If the value is 0, then the visitor is outside the EU and GDPR does not apply.
For example,
calling the Javascript IP geolocation webservice, the result for you is:
calling the JSON IP geolocation webservice, the result for you is:
calling the PHP IP geolocation webservice, the result for you is:
and so on for XML, ASP, and CSV webservices.
EU VAT Rate
European acts in the field of taxation have to be adopted by unanimity. The current provisions on VAT rates are thus the result of different compromises agreed by all the EU Ministers of Finance.
The VAT Directive sets the framework for the VAT rates in the EU, but it gives national governments freedom to set the number and level of rates they choose, but are to be applied as the standard rate for all goods and services.
If you are an EU business, doing business with an EU client, you must apply the VAT rate of the country your client resides in, not your country.
At geoPlugin, we help you determine what that rate is by specifying the General VAT rate (specified as a percentage) of your visitor's country
All main geoPlugin IP geolocation webservices identify whether the person is in the EU by the variable geoplugin_inEU.
If the value is 1, then the variable geoplugin_euVATrate tells you the %VAT that is required on any purchases for that person.
If the client is not in the EU, then the value of geoplugin_euVATrate is false.
For example,
calling the Javascript IP geolocation webservice, the result for you is:
calling the JSON IP geolocation webservice, the result for you is:
calling the PHP IP geolocation webservice, the result for you is:
and so on for XML, ASP, and CSV webservices.
See also
- In-depth User Guide
-
-
- geoPlugin webservice Extras