Monday 25 February 2019

Extracting coordinates - user friendly tool (4) (QGIS Plugin) - creating points, line, polygon

We have reach point when we are able to get WKT representation of plain text - for points, line and  polygon. Now it's time to visualize this 'horrible' string. I will show how to create spatial features from plain text in this post. If you familiar with one of the post dealing with creating 'asirpsace-like' polygons, you probably got idea how to do it. It is easy - actually we already got it and we only need to add very little code.

First we want to clear WKT string and table with extracted point, than extract coordinates - create table with points, to make sure that feature are created from current plain text:

self.dlg.textEditRawTextWKRTString.clear()
self.dlg.tableWidgetCoordinates.setRowCount(0)
self.extract_coordinates()

Sunday 17 February 2019

aviation_gis_tools2: 'core' part

It's been a while since I announced major changes to my 'aviation-python-gis' related project. I have even started using the redesigned classes in latest plugins, so it's time to share this new scripts. I am not going to be too much verbose, because basically it is more 'object oriented' version of previous version aviation_gis_tools.
In this post I am discussing 'core; part, I mean Python modules that names starts with 'core'. Those modules contains all basic functionality  such as: constants that are used throughout other modules and plugins and classes  and function that deal with distances, angles, bearings, magnetic variations, calculation on ellipsoid an other.

Source code can be found here:https://github.com/strpaw/aviation_gis_tools2

Saturday 16 February 2019

QGIS Plugin: AviationLatLonCalculator

Based on previous plugins related to calculating geographical coordinates given in various ways, it's time to combined all them into one handy plugin. In this case I will also use enhanced version of aviation gis tools scripts.

Wednesday 13 February 2019

Extracting coordinates - user friendly tool (3) (QGIS Plugin) - getting WKT string

If we have extracted coordinates, it would be nice to automatically to do something useful with them - creates points, line or polygon. So, next step is to add possibility to get WKT string  or create features such points, lines and polygonx. WKT  can be very handy - in case we want to copy and paste 'coordinates' into SQL statements in PostGIS for example.

Saturday 9 February 2019

Populate aviation_postgis_db with data from NASR files (1)

28 Day NASR Subscription data is a very good  source to start a series of post related to populating aviation_postgis_db database.  
In the post Parsing FAA NASR data: NATFIX file  I show the way of extracting data from NATFIX file into database. Our sample aviation database has limited scope, so we are not going to  retrieve all kind of information that can be found in NASR files, but only part of them. If you get familiar with files descriptions (refer to https://www.faa.gov/air_traffic/flight_info/aeronav/aero_data/NASR_Subscription_2019-02-28/, section 'The layout data for the Legacy (TXT) formats...) you will notice that basically data is arranged into fixed-length records for each airport, navigation aid and etc. The numbers of records can be variable, in case of Airport and Other Landing Facilities (APT file), in order to contain information about all runways related to given airport or aditional information. A 'record' is a line of text file, which  has 'fields' described by length, start location and justyfi - left or right. If there are various of record types in given file, each record starts with record type identifier. So, if we know at what  position the attribute we are interested in is, we are able to get it and assign to appropriate airport, navigation aid and so on.

Wednesday 6 February 2019

Extracting coordinates - user friendly tool (2) (QGIS Plugin)

We have managed to define what format of coordinates we are going to extract so far, now it's time to extract coordinates - 'real work' begins.
In this post following work is to do: user can paste raw text (NOTAM, part of eAIP or any other text with coordinates) into plugin, press button to extract coordinates, and get as result nice, easy to read table with coordinates.

Monday 4 February 2019

Extracting coordinates - user friendly tool (1) (QGIS Plugin)

In the real life (work) we rather not expect following workflow:
parse text and extract coordinates in the way described in the previous post.

Let's hide all that 'What is this all about' stuff behind QGIS Plugin. User can set all required parameters to extract coordinates and press 'extract' button to do so:


Sunday 3 February 2019

Extracting data tools - coordinates

I will use regular expressions to extract data from raw text and named tuples for convenient way to access tuple items, so first I import  required modules:

import re
from collections import namedtuple

I am going to build desired regular expression to extract coordinates from text based on coordinates order (lat-lon or lon-lat), coordinates formats and separator character that separates latitude and longitude within coordinate pair not one coordinate pair from another one.