Jump to content

Adding KATL as an airport <SOLVED>


onelifexv

Recommended Posts

I understand that. That wasn't the question. I'm curious as to where the 'Look up' actually pulls data from, whether it's internally and editable by an admin or whether it pulls from an external source, so I can fix issues like this and not need to rely on manual additoins.

Link to comment
Share on other sites

I understand that. That wasn't the question. I'm curious as to where the 'Look up' actually pulls data from, whether it's internally and editable by an admin or whether it pulls from an external source, so I can fix issues like this and not need to rely on manual additoins.

phpvms_airports table in your mysql database.

Link to comment
Share on other sites

  • Moderators

It's in admin/modules/operations and airports function will be the one but that function is connected to another function to find the airports which I don't know where it is, so my opinion is that instead of going through the whole lot of searching use the manual procedure.

Link to comment
Share on other sites

phpvms_airports table in your mysql database.

That's where airports that are saved are stored. I'm curious to know where the 'Lookup' function pulls it's data. KATL is the busiest airport in the world, kind of odd that it isn't in whatever database it's pulling from. I'm trying to determine if the lookup is pulling data stored locally or going elsewhere to find it's data.

Link to comment
Share on other sites

  • Administrators

The function is contained in the phpvmsadmin.js file in the admin lib folder.

function lookupICAO() {
icao = $("#airporticao").val();
if (icao.length != 4) {
 $("#statusbox").html("Please enter the full 4 letter ICAO");
 return false;
}
$("#statusbox").html("Fetching airport data...");
$("#lookupicao").hide();
if (airport_lookup == "geonames") {
 url = geourl + "/searchJSON?style=medium&maxRows=10&featureCode=AIRP&type=json&q=" + icao + "&callback=?";
}
else {
 url = phpvms_api_server + "/airport/get/" + icao + "&callback=?";
}
$.getJSON(url,
 function(data) {
  if (data.totalResultsCount == 0) {
   $("#statusbox").html("Nothing found. Try entering the full 4 letter ICAO");
   $("#lookupicao").show();
   return;
  }
  if (data.geonames) {
   data.airports = data.geonames;
  }
  $.each(data.airports, function(i, item) {
   $("#airporticao").val(icao);
   $("#airportname").val(item.name);
   $("#airportcountry").val(item.countryName);
   $("#airportlat").val(item.lat);
   $("#airportlong").val(item.lng);
   $("#statusbox").html("");
   $("#lookupicao").show();
  });
 });
return false;
}

It is called by the look up button in the ops_airportform.tpl file on line 6

<button id="lookupicao" onclick="lookupICAO(); return false;">Look Up</button>

The script will look in one of two places for the information;

if (airport_lookup == "geonames") {
 url = geourl + "/searchJSON?style=medium&maxRows=10&featureCode=AIRP&type=json&q=" + icao + "&callback=?";
}
else {
 url = phpvms_api_server + "/airport/get/" + icao + "&callback=?";
}

You set the resource in the app.config file and if you are changing it from the default you should move the code to your local.config file so it does not get over written.

/* Can be 'geonames' or 'phpvms'.
Geonames will use the geonames.org server to look up the airport info
phpvms will use the phpVMS API server
*/
Config::Set('AIRPORT_LOOKUP_SERVER', 'phpvms');
Config::Set('PHPVMS_API_SERVER', 'http://api.phpvms.net');
Config::Set('PHPVMS_NEWS_FEED', 'http://feeds.feedburner.com/phpvms');
Config::Set('VACENTRAL_NEWS_FEED', 'http://feeds.feedburner.com/vacentral');
Config::Set('GEONAME_API_SERVER', 'http://ws.geonames.org');

There are a few oddities on the geonames and phpvms airport database's, namely KORD - Chicago O'Hare comes up as being in Iran. I am sure there are a few more as well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...