Geolocation with Wappler and an API

I have been fiddling around with the Wappler implementation of their GeoLocation component and here are some additional things to possibly consider.

To use the Wappler version of the component you will need to make sure you have the page open you would like to use it with, have App Connect as well as Bootstrap 4 local or CDN added to the page and then click App in the App Structure and Add an App ID, now…

  1. Right Click App in the App Structure
  2. Select the Data Category and then Geo Location

Now that you have the component in place lets set some initial properties.

  1. Tracking you will use for live data updates as a person moves around with their mobile device
  2. Enable High Accuracy

This accuracy property is what interests me quite substantially, with it on/off my results are as follows

Latitude Longitude Accuracy High Accuracy ON/OFF
-29.7401522 30.818139700000003 20 OFF
-29.740152100000003 30.818143199999998 20 ON

And here is a google map showing the difference, so in my opinion I do not really see a major difference whether it is on or off to be honest, unless the Wappler Team give me one, I am not sure about speed advantages of having it off or on to be honest.

Now a few small things to note here are

  1. The built in component requires https protocol currently
  2. Please check if this is added to the head section of you code, it probably will be but just incase, double check anyway <script type="text/javascript" src="dmxAppConnect/dmxGeolocation/dmxGeolocation.js"></script>
  3. The user will be presented with a Block or Allow dialog when accessing your page with this component.

19

The wonderful part about using the Wappler component for this first part is that it is far more accurate than just using IP GeoLocation services. However the Wappler component offers a slightly limited set of bindings directly in the component listed below.

Binding My Output
support true
status OK
timestamp 1541789465224
coords > latitude -29.740152100000003
coords > longitude 30.818143199999998
coords > altitude
coords > accuracy 20
coords > altitudeAccuracy
coords > heading
coords > speed

Extending functionality with an API

I personally like using https://www.geoplugin.com from the user @geoplugin as it is firstly easy to use, it’s free up to a certain usage limitation which is quite high and it is easily documented. Note: I did register my domain name for free with the service.

What this service does for me is allow me to alter every price on my website from GBP Pound Sterling currency to whatever currency the user is forced to use in their particular origin country and it adjusts all the base prices i set with the latest current currency exchange rate.
eg. £100 is equal to R1845.13 South African Rand
The second thing I use this for is to determine if the user is from the United Kingdom specifically and display slightly extended information and functionality to United Kingdom based visitors as the website was designed around them to begin with, and the custom maps etc. are all based around them, so for users outside the UK they will see a more generic Google Map while a UK user will see a custom drawn map.
The UK Price will have International flight included within the price while outside user will see a reduced price excluding international flights.
Lastly the wording in some specific areas are slightly different for each user location.

Now that Wappler gives us the simplest API component around it is really easy to use for Wappler users.

  1. Right Click App in the App Structure
  2. Select the Data Category and then API Data Source

Please Note, below are instructions if you are using the free version without the SSL purchase, if you do purchase the SSL then all the below URL’s change to https://ssl.geo… from http://www.geo
Secondly the email would have provided you a key that needs to be inserted as a parameter to the query before you click Define API Schema, the parameter to add is
Name: k
Value: ‘123abc456xyz789’ (please note the single quotes surrounding the fake key)

Now that you have the component in place lets set some initial properties.

  1. URL is probably the most important step in this and for the base geoPlugin I used http://www.geoplugin.net/json.gp
  2. Click Define API Schema
  3. In the open dialog click Fetch Schema and click save.

That is really all there is to it, you can now click anywhere in your design view and bind whatever data you have available.

Some things to consider here are that the geoPlugin documentation says you need to provide the user remote IP address as a parameter to the URL, and you can ignore that as Wappler somehow just gets around that like magic. As @George says “duh” as though the magic is not magic to him :smile:
The one parameter I use is base_currency because the service assumes US Dollars and I am generally using GBP as my base.

  1. Select your API Data Source from the App Structure
  2. Click the + Button beside Query Parameters and input the below
    Name: base_currency
    Value: ‘GBP’ (please note the single quotes surrounding GBP)

As far as I can tell the only parameters the base json API takes is a remote IP which we can ignore and a base_currency value.
Here is the full output from the base json geoPlug API

Binding My Output
geoplugin_request 169.0.96.001
geoplugin_status 200
geoplugin_delay 1ms
geoplugin_credit Come of the returned data includes…
geoplugin_city Durban
geoplugin_region KwaZulu-Natal
geoplugin_regionCode NL
geoplugin_regionName KwaZulu-Natal
geoplugin_areaCode
geoplugin_dmaCode
geoplugin_countryCode ZA
geoplugin_countryName South Africa
geoplugin_inEU 0
geoplugin_euVATrate false
geoplugin_continentCode AF
geoplugin_continentName Africa
geoplugin_latitude -29.85
geoplugin_longitude 31.0167
geoplugin_locationAccuracyRadius 100
geoplugin_timezone Africa/Johannesburg
geoplugin_currencyCode ZAR
geoplugin_currencySymbol R
geoplugin_currencySymbol_UTF8 R
geoplugin_currencyConverter 18.4513

Now the problem as explained earlier is the accuracy and here is a picture to display the difference of Wappler to geoPlugin


As you can see that is quite a difference, my real location is where the marker is placed. The only way I can see around this is if @geoplugin adds 2 parameters to take lat & long so I can input the coords from Wappler rather.


Extending functionality with a second API

Again from geoPlugin there is a service i needed because the UK relies heavily upon Post Codes / Zip Codes

  1. Right Click App in the App Structure
  2. Select the Data Category and then API Data Source

Now that you have the component in place lets set some initial properties.

  1. URL is probably the most important step in this and for the base geoPlugin I used http://www.geoplugin.net/extras/postalcode.gp
  2. Click Define API Schema
  3. In the open dialog click Fetch Schema and click save.

There is one parameter you have to add to get the correct format output and that is
Name: format
Value: ‘json’ (please note the single quotes surrounding json)

The next 2 parameters I added to take advantage of the Wappler accuracy
Name: lat
Value: geo1.coords.latitude

Name: long
Value: geo1.coords.longitude

Now here is where you might find your first small issue as I did, the Wappler component requires https for a secure SSL connection and the geoPlugin allows you to access their secure service but you have to purchase an SSL certificate through them at €12 per year.

The second thing is that if you need to wait for the Wappler GeoLocation component to get the coords before querying the API then you need to select the API Data Source you just created from the App Structure and select “No Auto Load”
Now step 2, select the Wappler Geo Location component from the App Structure and click the + button beside Dynamic Events. Select the category of GeoLocation, and click Success, now click the Dynamic Data Selector beside the Action and select from the Available Actions the API Data Source which has “No Auto Load” set, arrow it out, and double click “Load” then hit Select to close the dialog.

You can now bind any of the data from that API to your page, for me I only wanted the geoPlugin_postCode which gave an output of 3610, where my initial test using the coords from the API gave me the incorrect Post Code, using the Wappler Accuracy I got the perfectly correct one.


Extending Functionality with a third API

Another from geoPlugin that I wanted is the “nearby” functionality

  1. Right Click App in the App Structure
  2. Select the Data Category and then API Data Source

Now that you have the component in place lets set some initial properties.

  1. URL is probably the most important step in this and for the base geoPlugin I used http://www.geoplugin.net/extras/nearby.gp
  2. Click Define API Schema
  3. In the open dialog click Fetch Schema and click save.

There is one parameter you have to add to get the correct format output and that is
Name: format
Value: ‘json’ (please note the single quotes surrounding json)

The next 2 parameters I added to take advantage of the Wappler accuracy
Name: lat
Value: geo1.coords.latitude

Name: long
Value: geo1.coords.longitude

The last 2 parameters I added for fun
Name: limit
Value: 10

Name: radius
Value: 300

Again select “No Auto Load” on this API call as we are using the more accurate coords from Wappler.
Select the Wappler Geo Location component from the App Structure and click the Dynamic Data Selector beside the Action because we already added the Success event earlier and select from the Available Actions the new API Data Source which has “No Auto Load” set, arrow it out, and double click “Load” then hit Select to close the dialog.
Now on success it will load both secondary API’s with the correct accurate lat and long values.

This was my output (Please make sure to bind the API data inside a repeat before binding the values)

3 Likes

Some small use cases I have already used are as follows

Change prices to the correct currency symbol and convert amount to target currency amount

{{(api1.data.geoplugin_currencyConverter * 100).formatCurrency(api1.data.geoplugin_currencySymbol+' ', ".", ",", "2")}}

Change 100 from the above code to any numeric value you like, or insert dynamic data in it’s place.
The output looks like this. R 1,845.13

The R (currency symbol) will change to whatever currency symbol is needed, and the price will correctly format with rounding up or down correctly.


To show different data to UK or non UK you could use a condition like this from Wappler although I will show some other ways too later on.

<div id="conditional_is_uk" is="dmx-if" dmx-bind:condition="api1.data.geoplugin_countryName != 'United Kingdom'">
  Not in United Kingdom
</div>
<div id="conditional_is_not_uk" is="dmx-if" dmx-bind:condition="api1.data.geoplugin_countryName == 'United Kingdom'">
  In United Kingdom
</div>

To show different temperature units in different locations.

<dmx-value id="var_temperature_units" dmx-bind:value="(api1.data.geoplugin_countryCode != 'US').then('&deg;C') || (api1.data.geoplugin_countryCode == 'US').then('&deg;F')"></dmx-value>

To use this just call the DMX Variable wherever you need to place your temperature units like this {{var_temperature_units.value}}

The output to a US visitor. °F
The output to a NON US visitor. °C


For us at geoPlugin, it was a "duh" moment right from the start, meaning if someone didn't provide an IP param, it automatically became the requesting IP. Apparently, geoplugin is unique in this!! For us it was "duh", so much so it was never documented!

note to self document this "duh"!

As for your request about everything from a lat/lon lookup, we take the position of no because everything can be achieved through multiple requests to the "extras" services (those are the ones using lat/lon mainly to locate). The reason is if there was 1 service that did all, it would mean many many db calls to achieve it (basically each "extra" is one different db call). We would do it clearly as it would be useful, but it would be abused (by experience) where everyone would use the "one-call-for-all" but only use one bit of the response (ie postcode), thereby putting undue stress on the overall service.

As per the GMX lat/lon results, you can take them to locate the nearest place (to not call nearby places, which is more intensive our side than "location.gp", since it restricts the db call to the closest place) - your lat/lon call:

http://www.geoplugin.net/extras/location.gp?lat=-29.740152100000003&long=30.818143199999998&format=json

gives

{"geoplugin_place":"Kloof","geoplugin_countryCode":"ZA","geoplugin_region":"KwaZulu-Natal","geoplugin_regionAbbreviated":"02","geoplugin_latitude":"-29.7852900","geoplugin_longitude":"30.8232500","geoplugin_distanceMiles":3.13,"geoplugin_distanceKilometers":5.04}

which by your browser geoloc shows the distance accurancy from you is pretty darn close.

Hope this helps!!
Andy

2 Likes

not sure what you mean by " if @geoplugin adds 2 parameters to take lat & long so I can input the coords from Wappler rather"
what would you like outputted by providing simply lat/lon?
1db call = place
1db call = postcode
less impacting that could be included is currency as this is a file lookup, not db call

I know it may seem trivial adding a db call, but when you’re handling 4k requests a second, each db call adds at least 10ms to the lookup overhead and that snowballs to latency in handling those waiting in the queue to be handled!

Well I'm glad I found it then :slight_smile:

Cheers to the great service btw! You guys rock!

If you have all the distance calculations and maybe an a map component based on something like openstreetsmap you will have even more additional value.

A lot of people are looking to dump google maps & geolocation due to their ridiculous pricing increase recently.

2 Likes

Thanks for the comments, makes far more sense now, and sounds like quite an intensive load on the servers.

All I am meaning by adding lat long to your base API is that the lat long results results from the IP lookup are quite a big distance from where my actual location is, but if i could send the more accurate lat long parameters instead of an IP Address then the API would have a much better idea of exactly where the user is.

However as you say maybe it is just not necessary as it will not really affect the big geographic stuff like country, it might affect city though i would imagine and obviously latitude and longitude and location accuracy radius.

So probably not really needed.

Thank you i will give this a try instead.

I am really trying to find closest airports possibly to the users location, but not too sure how to get that data back specific to airports.

I have an idea - I can add an geoplugin “extra” specific for airports if you want as I have an airport db. So you provide lat/lon and by default it provides the nearest airport - the problem is the db has this as list:

  • balloonport
  • closed
  • heliport
  • large_airport
  • medium_airport
  • seaplane_base
  • small_airport

closed is clearly useless, nearest large maybe 100km away while small may be 10km, so what to pick by default???

coverage is shown on this lovely image I made for fun once (colours are elevation, each dot an “airport” as above)

2 Likes

For my particular use case I would really only be interested in the large international type airports, but for future and other peoples usage I think it would be amazing if they could also choose any of the other types.
Wow this would really be amazing. Thank you @geoplugin

One quick question while I am at it, I want to get your SSL option in the next few minutes, however I have one domain which is just the test environment while i develop and another which is for the real website i am developing, I assume a single SSL only allows me to use it on a single domain name, but figured i should just check with you.

not correct - one ssl key can do all your domains (within the 120 lookup limit)

1 Like

Wonderful, thank you very much, even better than i had hoped. :smiley:

This seems as an fantastic data source! I wonder what other valuable data sources you have @geoplugin!

Also maybe there are more public airport information API's like for fetching actual flights info.
People really want to check the arrivals very often or track flights. I think there are many apps doing so already. Even with drawing the flights on a map.

1 Like

Here it is:
http://www.geoplugin.net/extras/nearest_transport.gp?format=json

params:
format (output format): php (default), json, xml
type (transport hub type): airport (default), station, port, all
limit (number of results to return): from 1 to 20 (default: 10)
lat: latitude
long: longitude
(if lat/long not provided, the lat/lon of user IP is used)

Example:

http://www.geoplugin.net/extras/nearest_transport.gp?format=xml&limit=10&type=all

Gives for my IP
<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>Liverpool Street Station</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>ZLS</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.5201006</geoplugin_latitude>
		<geoplugin_longitude>-0.0800884</geoplugin_longitude>
		<geoplugin_altitude>131.00</geoplugin_altitude>
		<geoplugin_distanceMiles>0.69</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>1.11</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>34.32</geoplugin_directionAngle>
		<geoplugin_directionHeading>NE</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>St Pancras Railway Station</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>QQS</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.5325195</geoplugin_latitude>
		<geoplugin_longitude>-0.1263004</geoplugin_longitude>
		<geoplugin_altitude>80.00</geoplugin_altitude>
		<geoplugin_distanceMiles>1.91</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>3.07</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>28.25</geoplugin_directionAngle>
		<geoplugin_directionHeading>NNE</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>Euston Station</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>QQU</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.5284000</geoplugin_latitude>
		<geoplugin_longitude>-0.1331000</geoplugin_longitude>
		<geoplugin_altitude>89.00</geoplugin_altitude>
		<geoplugin_distanceMiles>1.98</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>3.19</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>40.02</geoplugin_directionAngle>
		<geoplugin_directionHeading>NE</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>Paddington Station</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>QQP</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.5158330</geoplugin_latitude>
		<geoplugin_longitude>-0.1761110</geoplugin_longitude>
		<geoplugin_altitude>0.00</geoplugin_altitude>
		<geoplugin_distanceMiles>3.57</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>5.75</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>84.18</geoplugin_directionAngle>
		<geoplugin_directionHeading>E</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>London City Airport</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode>GB</geoplugin_countryCode>
		<geoplugin_IATA>LCY</geoplugin_IATA>
		<geoplugin_ICAO>EGLC</geoplugin_ICAO>
		<geoplugin_latitude>51.5052990</geoplugin_latitude>
		<geoplugin_longitude>0.0552780</geoplugin_longitude>
		<geoplugin_altitude>19.00</geoplugin_altitude>
		<geoplugin_distanceMiles>6.41</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>10.32</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>96.55</geoplugin_directionAngle>
		<geoplugin_directionHeading>E</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>London Heathrow Airport</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode>GB</geoplugin_countryCode>
		<geoplugin_IATA>LHR</geoplugin_IATA>
		<geoplugin_ICAO>EGLL</geoplugin_ICAO>
		<geoplugin_latitude>51.4706000</geoplugin_latitude>
		<geoplugin_longitude>-0.4619410</geoplugin_longitude>
		<geoplugin_altitude>83.00</geoplugin_altitude>
		<geoplugin_distanceMiles>16.15</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>25.99</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>99.15</geoplugin_directionAngle>
		<geoplugin_directionHeading>E</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>Ebbsfleet International Railway Station</geoplugin_name>
		<geoplugin_city>Ebbsfleet Valley</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>XQE</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.4430390</geoplugin_latitude>
		<geoplugin_longitude>0.3208830</geoplugin_longitude>
		<geoplugin_altitude>43.00</geoplugin_altitude>
		<geoplugin_distanceMiles>18.48</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>29.74</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>104.69</geoplugin_directionAngle>
		<geoplugin_directionHeading>ESE</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>London Gatwick Airport</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode>GB</geoplugin_countryCode>
		<geoplugin_IATA>LGW</geoplugin_IATA>
		<geoplugin_ICAO>EGKK</geoplugin_ICAO>
		<geoplugin_latitude>51.1481020</geoplugin_latitude>
		<geoplugin_longitude>-0.1902780</geoplugin_longitude>
		<geoplugin_altitude>202.00</geoplugin_altitude>
		<geoplugin_distanceMiles>25.64</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>41.26</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>170.16</geoplugin_directionAngle>
		<geoplugin_directionHeading>S</geoplugin_directionHeading>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>station</geoplugin_type>
		<geoplugin_name>Stevenage Railway Station</geoplugin_name>
		<geoplugin_city>Stevenage</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode></geoplugin_countryCode>
		<geoplugin_IATA>XVJ</geoplugin_IATA>
		<geoplugin_ICAO>N</geoplugin_ICAO>
		<geoplugin_latitude>51.9020000</geoplugin_latitude>
		<geoplugin_longitude>-0.2070000</geoplugin_longitude>
		<geoplugin_altitude>314.00</geoplugin_altitude>
		<geoplugin_distanceMiles>27.23</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>43.83</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>1.13</geoplugin_directionAngle>
		<geoplugin_directionHeading/>
	</geoPlugin_transport>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>London Luton Airport</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode>GB</geoplugin_countryCode>
		<geoplugin_IATA>LTN</geoplugin_IATA>
		<geoplugin_ICAO>EGGW</geoplugin_ICAO>
		<geoplugin_latitude>51.8746986</geoplugin_latitude>
		<geoplugin_longitude>-0.3683330</geoplugin_longitude>
		<geoplugin_altitude>526.00</geoplugin_altitude>
		<geoplugin_distanceMiles>27.56</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>44.35</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>1.7</geoplugin_directionAngle>
		<geoplugin_directionHeading/>
	</geoPlugin_transport>
</geoPlugin>

Another example getting the closest (limit=1) airport (type=airport, which is default)
http://www.geoplugin.net/extras/nearest_transport.gp?format=xml&limit=1

Gives for me
<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>London City Airport</geoplugin_name>
		<geoplugin_city>London</geoplugin_city>
		<geoplugin_country>United Kingdom</geoplugin_country>
		<geoplugin_countryCode>GB</geoplugin_countryCode>
		<geoplugin_IATA>LCY</geoplugin_IATA>
		<geoplugin_ICAO>EGLC</geoplugin_ICAO>
		<geoplugin_latitude>51.5052990</geoplugin_latitude>
		<geoplugin_longitude>0.0552780</geoplugin_longitude>
		<geoplugin_altitude>19.00</geoplugin_altitude>
		<geoplugin_distanceMiles>6.41</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>10.32</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>96.55</geoplugin_directionAngle>
		<geoplugin_directionHeading>E</geoplugin_directionHeading>
	</geoPlugin_transport>
</geoPlugin>

If we want another person’s IP lat/lon if we don’t have their lat/lon, using an IP address (from San Francisco):
http://www.geoplugin.net/extras/nearest_transport.gp?format=xml&limit=1&ip=136.0.16.217

gives
<?xml version="1.0" encoding="UTF-8"?>
<geoPlugin>
	<geoPlugin_transport>
		<geoplugin_type>airport</geoplugin_type>
		<geoplugin_name>San Francisco International Airport</geoplugin_name>
		<geoplugin_city>San Francisco</geoplugin_city>
		<geoplugin_country>United States</geoplugin_country>
		<geoplugin_countryCode>US</geoplugin_countryCode>
		<geoplugin_IATA>SFO</geoplugin_IATA>
		<geoplugin_ICAO>KSFO</geoplugin_ICAO>
		<geoplugin_latitude>37.6189995</geoplugin_latitude>
		<geoplugin_longitude>-122.3750000</geoplugin_longitude>
		<geoplugin_altitude>13.00</geoplugin_altitude>
		<geoplugin_distanceMiles>11.04</geoplugin_distanceMiles>
		<geoplugin_distanceKilometers>17.77</geoplugin_distanceKilometers>
		<geoplugin_directionAngle>164.09</geoplugin_directionAngle>
		<geoplugin_directionHeading>SSE</geoplugin_directionHeading>
	</geoPlugin_transport>
</geoPlugin>

How does that seem to those who are interested in this type of thing?
I’ll document it on geoplugin.com in the coming days for others.

3 Likes

This is really cool. I have another question and you let me know if it is possible…

Is it possible to show the closest metro station of Athens (Greece) metro’s.

Thank you

1 Like

If you can find me a database of all metro/subway stations (not just a specific country), I can add them as “metro” type (of course, there needs to be lat/lon coordinates!)

eg, London metro is here (probably a downloadable format somewhere):
https://wiki.openstreetmap.org/wiki/List_of_London_Underground_stations

this one is rich, but no idea which city it is: https://developer.metro.net/introduction/gis-data/download-gis-data/

etc etc

Currently, the “station” type is poor (only a few hundred), whereas airports (only airports having scheduled services from them) have nearly 4k entries.
I’ll update the stations data with a europe-rich dataset from https://github.com/trainline-eu/stations shortly

3 Likes

This looks very interesting.
I own the http://www.metro.gr/?lang=en and had created (many years ago) something with the, old-school, dmx data-bindings.
Had manually placed all lats and lons of Athens metro station (but it needs an update).

Also after the latest google policy update website looks abandoned. Been thinking of ideas to re-birth it and the new Api component brings many more options.

1 Like

Absolutely brilliant, working to perfection, man this is exciting, I am really going to be able to do some amazing stuff with this for any travel industry websites. So So So excited, Thank you.

Here is a sample of my output.

2 Likes

Really glad it helps you out @psweb
this is what it’s all about - relatively nothing for me to add as the lat/lon database was already available, so why not add it to make other people’s lives easier!

2 Likes

@geoplugin, I am really happy you are eager to assist, this Wappler community website and the Wappler team are really all just like you, friendly, and eager to help, so when you ready to build a new front end site I am sure you are going to find this an amazing place to hang out.

Just grateful that you are like minded as it makes the community even stronger here.

3 Likes

Now all I need to do is try and win this weeks challenge with all this API information in my head.

2 Likes