Wednesday 27 March 2019

How to 'convert' table from pdf to csv (example of extracting points)

Let's imagine that you have  pdf files with some data. You need to extract some of this data for further processing: e. g. file contains table with points with some attributes such as name and your goal is to get points layer from this file. If tables are nicely formatted in the way that if you copy and paste them into text file you will get something that looks like a 'table', I have a good news for you: there is no need to use extra libraries of tools to extract desired data. You can extract data manually by using spreadsheet for example (which is something we are not going to do), websites which converts pdf into other format and etc. You can also take advantage of the fact, that copied table is 'nicely' formatted  and write parser that will extract desired data. It is worth to do that, if we are going to process data in cycles, for example parts of AIP.

Monday 18 March 2019

CoordinateExtractor Plugin: improvements

However CoordinateExtractorPlugin work as we expect - there are still some features that are missing that significantly increase capability of getting pairs of coordinates from plain text. The first is quite obvious - user should be able to define her or his own latitude-longitude separator. (I might have implemented only this option from the beginning actually). The second one comes form the fact, that there are possible some deviation from the pattern of coordinates, such as variable number of blank characters as latitude-longitude separator, or in the string that is latitude-longitude separator.

First, we need to change a bit GUI for dialog:
for comboBoxCoordSeparator add new item 'User defined'
new QLineEdit: lineEditUserSeparator
new QCheckBox: checkBoxReomveBlanks
 
Method that sets separator between latitude and longitude has to be changed, so it will takes user defined separator: 


def set_latlon_separator(self):
    if self.dlg.comboBoxCoordSeparator.currentIndex() == 0:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = None
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 1:  # Null separator
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_NULL
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 2:  # Space
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_SPACE
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 3:  # Hyphen
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_HYPHEN
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 4:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = cet.SEP_SLASH
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 5:
        self.dlg.lineEditUserSeparator.setEnabled(False)
        self.latlon_separator = '\\'
    elif self.dlg.comboBoxCoordSeparator.currentIndex() == 6:
        self.dlg.lineEditUserSeparator.setEnabled(True)
        self.latlon_separator = self.dlg.lineEditUserSeparator.text()



Wednesday 13 March 2019

Module: core_predetermined_angle

In most cases when we will deal with aviation content, especially for large dataset, such eTOD, format of coordinate is known in advance, or 'predetermined' in other words. Some parts of AIP also have one, chosen specified coordinate format also. So, there is no need to 'guess' what coordinate format is in order to convert it into DD. This issue was typical when we deal with frequently changing source, such NOTAM or single instances of airports, runway thresholds when.

Monday 11 March 2019

Loading point data into PostGIS: significant points example

In the previous post I created table and populated it with data from CSV file, but with no spatial 'part'. This time I going to load from CSV source points into database. CSV files are very common and there are plenty of various kind of data stored in this format.
In AIP, ENR part you can find list of  'Name-code designators for significant points'.
If we have this data into CSV forma, we can do following steps to create spatial data:

Create temporary waypoint table:

Saturday 9 March 2019

What STWL stands for? And FAS or DER? Abbreviation table.

Aviation domain has countless number of abbreviations and acronyms that are used in publications such as NOTAMs or charts.
To make life a bit (or rather much) easier it is a good idea to create a table with abbreviations, which will contain as many as possible abbreviations, acronyms and their meanings for quick reference if we work with aviation content.