JSON Aircraft DB - Extra field

I have been doing a lot of playing around with building my own JSON DB to work with custom graphics and figured out I can change the ICAO Aircraft Designator field to say pretty much whatever I want and then set whatever graphics I want to map to those descriptions.

At the moment the info pop up reads the aircraft type from the DB entry:
https://dl.dropboxusercontent.com/u/50785283/StandardInfo.JPG

Now if I change the aircraft type as below in the CSV:

C8225F,ZK-KWI,CJ6
C82260,ZK-SDL,CAML
C82261,ZK-LPK,PNR3
C82268,ZK-OXJ,A320-232
C82269,ZK-OXK,A320
C8226A,ZK-PAW,C172

Then add the extra type to the markers.js:

*var TypeDesignatorIcons = {
// Airbus
‘A318’: _a318, ‘A319’: _a319, ‘A320’: _a320, ‘A321’: _a320, // stretched a320
‘A332’: _a332, ‘A333’: _a333,
‘A342’: _a343, ‘A343’: _a343, ‘A345’: _a345, ‘A346’: _a346,
‘A358’: _a358, ‘A359’: _a359, ‘A35K’: _a35k,
‘A388’: _a388,

** //Petes Special Test
‘A320-214’: _a320, ‘A320-232’: _a320,**
*

Then I get the following displayed:
https://dl.dropboxusercontent.com/u/50785283/NewInfo.JPG

The source data I have would make this a fairly easy change to make, it will just vastly increase the number of TypeDesignators I would need in the markers.js

This got me thinking, how hard would it be to add a descriptor field to the JSON DB and then have an option to display this instead of the standard type designator?

I haven’t tried this yet but I strongly suspect putting a space in the descrptor as it is could break things…

Should be fine. The existing DB uses ICAO designators mostly because that’s what the existing data I had available gave me.
You can add extra columns to the csv if you want and they will end up in the json (named by what you put in the header line for that column) and can be accessed in the map javascript, if you wanted to add a more specific typename in addition to the designator rather than instead of it.

Excellent, will give it a shot and see what I come up with…

Here is the Excel sheet I am using to build the JSON DB, Just added in a new short description field, it is picking up the Aircraft model by default, but I will override this for many as they are too long, code in there to remove spaces too as a safety measure :slight_smile:

There is a lot of autoformatting on the main sheet, this mornings imports are in and the last additions from the NZ register update that came in yesterday (they provide a CSV on the 2nd of month, I compare with previous for changes). The autoformatting picks up and duplicate regos and ICAO24s, this is quite useful when adding new items.

Colour codes are Cyan (light blue) for new incomplete entry from NZ register (usually without ICAO24), blue for loaded from NZ register but I have never seen it, yellow for I have got this from another source but not seen it (I preload fleets I know might show up here and some of these entries are fro the original VRS.CSV), orange is for I know you exist, never seen you and have no idea what you are (this is mainly ground support stuff at local airport).

Someone here might find this useful.

https://dl.dropboxusercontent.com/u/50785283/AirframeDB.xlsx

I am having trouble figuring out how the JSON data is mapped through to the variables in the JS files, I am assuming that is done in the dbloader.js?

Have a look at the closure passed to getAircraftData() in the PlaneObject ctor.

Got it! Took me a while, new variable needs to be defined in style.css as well:

style.css:
#selected_icao { font-size: x-small; }
#selected_registration { font-size: x-small; }
#selected_icaotype { font-size: x-small; }
#selected_LongName { font-size: x-small; }

PlaneObject.js:

  •            if ("desc" in data) {
                      this.LongName = data.desc;
      		}*
    

Interesting though, there was a DB call for a description already, couldn’t get it to work properly, going to try and revert to that to minimise changes…

Actually style.css has nothing to do with it!

Got is working now using the typeDescription variable :slight_smile:

https://dl.dropboxusercontent.com/u/50785283/AircraftType.JPG

Spaces in the CSV are OK, they JSON builder python script doesn’t break :smiley:
https://dl.dropboxusercontent.com/u/50785283/SpacesOK.JPG

OK got the hang of it now :slight_smile: Have the owner/airline in the DB too:
https://dl.dropboxusercontent.com/u/50785283/Owner1.JPG https://dl.dropboxusercontent.com/u/50785283/Owner2.JPG