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, 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


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&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



The location of 37.751/-97.822 (you) is:

	 Place: Haven
Country Code: US
Region: Kansas
Latitude: 37.8685989
Longitude: -97.7771988
Distance (miles): 8.48
Distance (km): 13.66


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 'place' GET variable is an ASCII-encoded place name that is URL-encoded
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 for example Boston, US gives:

1:
geoplugin_latitude: 42.3584300
geoplugin_longitude: -71.0597700
geoplugin_place: Boston
geoplugin_region: Massachusetts
geoplugin_regionCode: MA
geoplugin_countryCode: US
2:
geoplugin_latitude: 30.7918600
geoplugin_longitude: -83.7898900
geoplugin_place: Boston
geoplugin_region: Georgia
geoplugin_regionCode: GA
geoplugin_countryCode: US
3:
geoplugin_latitude: 39.7411600
geoplugin_longitude: -84.8519000
geoplugin_place: Boston
geoplugin_region: Indiana
geoplugin_regionCode: IN
geoplugin_countryCode: US
4:
geoplugin_latitude: 37.7875600
geoplugin_longitude: -85.6727400
geoplugin_place: Boston
geoplugin_region: Kentucky
geoplugin_regionCode: KY
geoplugin_countryCode: US
5:
geoplugin_latitude: 33.4415100
geoplugin_longitude: -94.4196500
geoplugin_place: Boston
geoplugin_region: Texas
geoplugin_regionCode: TX
geoplugin_countryCode: US
6:
geoplugin_latitude: 38.5409600
geoplugin_longitude: -78.1316700
geoplugin_place: Boston
geoplugin_region: Virginia
geoplugin_regionCode: VA
geoplugin_countryCode: US
7:
geoplugin_latitude: 42.6289500
geoplugin_longitude: -78.7375300
geoplugin_place: Boston
geoplugin_region: New York
geoplugin_regionCode: NY
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.

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&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




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





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: Wichita Eisenhower National Airport
geoplugin_city: Wichita
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: ICT
geoplugin_ICAO: KICT
geoplugin_latitude: 37.6498990
geoplugin_longitude: -97.4330980
geoplugin_distanceMiles: 22.38
geoplugin_distanceKilometers: 36.01
geoplugin_directionAngle: 104.37
geoplugin_directionHeading: ESE
2:
geoplugin_type: airport
geoplugin_name: Salina Municipal Airport
geoplugin_city: Salina
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: SLN
geoplugin_ICAO: KSLN
geoplugin_latitude: 38.7910004
geoplugin_longitude: -97.6521988
geoplugin_distanceMiles: 72.44
geoplugin_distanceKilometers: 116.58
geoplugin_directionAngle: 5.16
geoplugin_directionHeading:
3:
geoplugin_type: airport
geoplugin_name: Manhattan Regional Airport
geoplugin_city: Manhattan
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: MHK
geoplugin_ICAO: KMHK
geoplugin_latitude: 39.1409988
geoplugin_longitude: -96.6707993
geoplugin_distanceMiles: 114.47
geoplugin_distanceKilometers: 184.22
geoplugin_directionAngle: 6.78
geoplugin_directionHeading:
4:
geoplugin_type: airport
geoplugin_name: Dodge City Regional Airport
geoplugin_city: Dodge City
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: DDC
geoplugin_ICAO: KDDC
geoplugin_latitude: 37.7634010
geoplugin_longitude: -99.9655991
geoplugin_distanceMiles: 117.09
geoplugin_distanceKilometers: 188.44
geoplugin_directionAngle: 83.73
geoplugin_directionHeading: E
5:
geoplugin_type: airport
geoplugin_name: Tulsa International Airport
geoplugin_city: Tulsa
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: TUL
geoplugin_ICAO: KTUL
geoplugin_latitude: 36.1983986
geoplugin_longitude: -95.8880997
geoplugin_distanceMiles: 151.32
geoplugin_distanceKilometers: 243.53
geoplugin_directionAngle: 176.24
geoplugin_directionHeading: S


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 37.751/-97.822 (you) is:

	 Place: Haven
Country Code: US
Post Code: 67543
Latitude: 37.8685989
Longitude: -97.7771988
Distance (miles): 8.48
Distance (km): 13.66
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 'postcode' GET variable is a URL-encoded postcode
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.228.21.186), we found the closest Postal Code (67543), which forward geocodes to:

	 Post Code: 67543
Latitude: 37.868599
Longitude: -97.777199
Place: Haven
County: Reno
Region: Kansas
Region Code: KS
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

 
 


Acceptable Use Policy    Privacy Policy and User Agreement    Contact geoPlugin


©2006 - 2019 geoPlugin® is a registered trademark of GEOPLUGIN, SAS