geoPlugin Home
Command disabled: index

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


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





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 your place (Columbus, US) gives:

1:
geoplugin_latitude: 39.9611800
geoplugin_longitude: -82.9987900
geoplugin_place: Columbus
geoplugin_region: Ohio
geoplugin_regionCode: OH
geoplugin_countryCode: US
2:
geoplugin_latitude: 33.7759500
geoplugin_longitude: -93.8171300
geoplugin_place: Columbus
geoplugin_region: Arkansas
geoplugin_regionCode: AR
geoplugin_countryCode: US
3:
geoplugin_latitude: 39.9881000
geoplugin_longitude: -91.1468100
geoplugin_place: Columbus
geoplugin_region: Illinois
geoplugin_regionCode: IL
geoplugin_countryCode: US
4:
geoplugin_latitude: 36.7597800
geoplugin_longitude: -89.1034000
geoplugin_place: Columbus
geoplugin_region: Kentucky
geoplugin_regionCode: KY
geoplugin_countryCode: US
5:
geoplugin_latitude: 42.8822500
geoplugin_longitude: -82.6624200
geoplugin_place: Columbus
geoplugin_region: Michigan
geoplugin_regionCode: MI
geoplugin_countryCode: US
6:
geoplugin_latitude: 40.0726100
geoplugin_longitude: -74.7207200
geoplugin_place: Columbus
geoplugin_region: New Jersey
geoplugin_regionCode: NJ
geoplugin_countryCode: US
7:
geoplugin_latitude: 42.6839600
geoplugin_longitude: -75.3726700
geoplugin_place: Columbus
geoplugin_region: New York
geoplugin_regionCode: NY
geoplugin_countryCode: US
8:
geoplugin_latitude: 41.9408900
geoplugin_longitude: -79.5817200
geoplugin_place: Columbus
geoplugin_region: Pennsylvania
geoplugin_regionCode: PA
geoplugin_countryCode: US
9:
geoplugin_latitude: 43.3380500
geoplugin_longitude: -89.0153900
geoplugin_place: Columbus
geoplugin_region: Wisconsin
geoplugin_regionCode: WI
geoplugin_countryCode: US
10:
geoplugin_latitude: 31.8276000
geoplugin_longitude: -107.6400200
geoplugin_place: Columbus
geoplugin_region: New Mexico
geoplugin_regionCode: NM
geoplugin_countryCode: US
11:
geoplugin_latitude: 38.1102100
geoplugin_longitude: -118.0192800
geoplugin_place: Columbus
geoplugin_region: Nevada
geoplugin_regionCode: NV
geoplugin_countryCode: US
12:
geoplugin_latitude: 48.9042000
geoplugin_longitude: -102.7804500
geoplugin_place: Columbus
geoplugin_region: North Dakota
geoplugin_regionCode: ND
geoplugin_countryCode: US
13:
geoplugin_latitude: 45.2652200
geoplugin_longitude: -93.0501500
geoplugin_place: Columbus
geoplugin_region: Minnesota
geoplugin_regionCode: MN
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.



Nearby places to you include:

1:
Place: Columbus
Region: Ohio
Latitude: 39.9611800
Longitude: -82.9987900
Distance (miles): 0.4
Distance (km): 0.64
Direction (degrees) 105.96
Direction (heading) ESE
2:
Place: Bexley
Region: Ohio
Latitude: 39.9689500
Longitude: -82.9376800
Distance (miles): 3.65
Distance (km): 5.87
Direction (degrees) 83.14
Direction (heading) E
3:
Place: Upper Arlington
Region: Ohio
Latitude: 39.9945100
Longitude: -83.0624100
Distance (miles): 3.71
Distance (km): 5.97
Direction (degrees) 50.1
Direction (heading) NE
4:
Place: Whitehall
Region: Ohio
Latitude: 39.9667300
Longitude: -82.8854600
Distance (miles): 6.39
Distance (km): 10.29
Direction (degrees) 89.53
Direction (heading) E
5:
Place: Grove City
Region: Ohio
Latitude: 39.8814500
Longitude: -83.0929600
Distance (miles): 7.25
Distance (km): 11.67
Direction (degrees) 148.92
Direction (heading) SSE




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: John Glenn Columbus International Airport
geoplugin_city: Columbus
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: CMH
geoplugin_ICAO: KCMH
geoplugin_latitude: 39.9980010
geoplugin_longitude: -82.8918990
geoplugin_distanceMiles: 6.52
geoplugin_distanceKilometers: 10.5
geoplugin_directionAngle: 67.02
geoplugin_directionHeading: ENE
2:
geoplugin_type: airport
geoplugin_name: Rickenbacker International Airport
geoplugin_city: Columbus
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: LCK
geoplugin_ICAO: KLCK
geoplugin_latitude: 39.8138010
geoplugin_longitude: -82.9278030
geoplugin_distanceMiles: 11.08
geoplugin_distanceKilometers: 17.83
geoplugin_directionAngle: 164.84
geoplugin_directionHeading: SSE
3:
geoplugin_type: airport
geoplugin_name: James M Cox Dayton International Airport
geoplugin_city: Dayton
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: DAY
geoplugin_ICAO: KDAY
geoplugin_latitude: 39.9024010
geoplugin_longitude: -84.2193985
geoplugin_distanceMiles: 64.41
geoplugin_distanceKilometers: 103.66
geoplugin_directionAngle: 122.72
geoplugin_directionHeading: ESE
4:
geoplugin_type: airport
geoplugin_name: Mid Ohio Valley Regional Airport
geoplugin_city: Parkersburg
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: PKB
geoplugin_ICAO: KPKB
geoplugin_latitude: 39.3451004
geoplugin_longitude: -81.4392014
geoplugin_distanceMiles: 93.63
geoplugin_distanceKilometers: 150.68
geoplugin_directionAngle: 173.27
geoplugin_directionHeading: S
5:
geoplugin_type: airport
geoplugin_name: Akron Canton Regional Airport
geoplugin_city: Akron
geoplugin_country: United States
geoplugin_countryCode: US
geoplugin_IATA: CAK
geoplugin_ICAO: KCAK
geoplugin_latitude: 40.9160995
geoplugin_longitude: -81.4421997
geoplugin_distanceMiles: 105.37
geoplugin_distanceKilometers: 169.58
geoplugin_directionAngle: 86.94
geoplugin_directionHeading: 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&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.9625/-83.0061 (you) is:

	 Place: Columbus
Country Code: US
Post Code: 43215
Latitude: 39.9670982
Longitude: -83.0044022
Distance (miles): 0.33
Distance (km): 0.53
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 (18.223.32.230), we found the closest Postal Code (43215), which forward geocodes to:

	 Post Code: 43215
Latitude: 39.967098
Longitude: -83.004402
Place: Columbus
County: Franklin
Region: Ohio
Region Code: OH
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 - 2024 geoPlugin® is a registered trademark of GEOPLUGIN, SAS