QuestionQuestion

Transcribed TextTranscribed Text

Python Programming for Geoscience Flight plan validation Introduction In 2014, am addition to the Austrian Aviation Law (Luftfahrtgesetz) was made to include ummenned aerial vehicles (UAVs). This law regulates the use of UAVs, both for professional and non-professional users. UAVs (Class 1, requiring constant line-of-sight with the pilot) are categorized by their ake-off-weight and the aren of aseaccording to Tab. 1. For operation in class "A" a registration with Austro Control the austrian aviation safety agency, has to be made. Additionally, the UAV has to be insured up to a certain sum. The maximum height for operation is 150 m above ground level. For the other classes, different tests have to be pressed by the pilot. as well as of her restrictions apply. non-built-up unsetteled Take-off-weight populated demsly populated (unbebaut) (unbesiedelt) (besiedelt) (dicht bedsiedelt) up kg A A B C up 25 kg A B C D 25 100 kg B C D D Table 1: Categories for UAVs according to Austrian Aviation Law. UAVs with maximum kimetic energy of 79J are considered toys and the Luftfahrtgesetz does not apply. Those toys may not be flown higher than 30m above ground level. This kinetic energy is usually approximated via a maximum weight of 230g and . maximum velocity of 60km/h. For all airborne systems, special restrictions when flying near airports or similar zones apply. Task Your task is to rend a GPS track of a planned UAV flight and usea errain in odel (in T 'IFF-format) nd a polygon- Shapef ile containing mo-Bly-zomes, to create n appshowing - here the flight path is violating the Aus- trian Aviation Law. For this, you should consider the maximum height (above the termain model) as well as the restricted areas. The requirement for line-of-sight between the UAV and the pilot is out of scope for this exercise and does not have to be considered Also, you may assume that the neccessary registrations with Austro Control have been made, and that you are operation under either Category 'A' or as toy. Implementation The program should take the following arguments (use sys.argv): UAV type (A or toy) path to GPS track (in CSV format, see track1. cav. track2. cav and track3. cav) path to terrain model (25_1_dgn. tif, data by Stadt Wien (CC-BY-AT 3.0)) path to restricted zomes (mo-fly.shp) The terrain model and the restriced zones- file are provided im E he projected coordinate system Gauss-Krüger M34 (EPSG:31255). The GPS track is in ellipsoidal coordinates of the WGS84 datum (EPSG:4326). Please mote that the height (z-Coordinate) of the GPS-track is alrendy in the same system as the DTM (Höhe über Wiener Null), Le. don't use the transformed height. but the original one from the CSV file. All flesare available on TUWEL The output should be a text stating whether or not the planned flight path jolates t he law state be rea- son(s)), or not, as well as a map showing the flight pathandt be errain model, ad he estriced n reas. Use color to indicate problematic parts of the path. Since the planned flight pathis given a list of points, o ne might hink finterpolating be line segments between the points and check the comditions on the segments. Due to the dense spacing (< 0.5m) of the GPS track. this is not meccessary. Instead, check the comditions for each point of the flight path seperately You can also plot the path as a collection of points (e.g. using plt.scatter) Hints Visualize the data in QGIS or a similer system before you start programming For the import of the GPS track, the numpy package can be used. Skip the first inea ndt hel ast col- umn. Convert the coordinates (Int /lon) toogr Geometry (type Point) objects, then transform them to the system of the terrain model using osr. A quick check if the transformation is correct is that the nor-malized height (height above ground) should start and end close to 0 (take-off and landing) for all three tracks. Use gdal to get the terrain height at the position of every point of the track. Also makce sure that the UAV does not erash into the terrain. Additionally, check for ench point of the track whether it lies within any of the polygons representing the restricted arens. The polygons are simple (mo holes, no overlaps). For plotting, you can use matplotlib or any other plotting library. Try to create useful axis ticks and la- bels. Don't forget to add legend PSInce the track polnta the grid billinent Interpolation abouald be used In general when retrieving height Information reabez file. For the purpone of this exerche, you can ignore this fact and the helght of the menread grid point Imabend. Google will help you with that 2

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

"""
    Importing essential packages.
"""
import gdal, osr
import numpy as np
import pandas as pd
from osgeo import osr
from osgeo import ogr
from geopandas import GeoDataFrame
import matplotlib.pyplot as plt
from descartes import PolygonPatch
from shapely.geometry import LinearRing
from shapely.geometry import shape
import sys

"""
Creating transformations
"""
source = osr.SpatialReference()
source.ImportFromEPSG(4326)
target = osr.SpatialReference()
target.ImportFromEPSG(31256)
transform = osr.CoordinateTransformation(source, target)

"""
This method reads the tif file and converts the raster to array.
"""
def raster2array(geotif_file):
    metadata = {}
    dataset = gdal.Open(geotif_file)
    metadata['array_rows'] = dataset.RasterYSize
    metadata['array_cols'] = dataset.RasterXSize
    metadata['bands'] = dataset.RasterCount
    metadata['driver'] = dataset.GetDriver().LongName
    metadata['projection'] = dataset.GetProjection()
    metadata['geotransform'] = dataset.GetGeoTransform()

    mapinfo = dataset.GetGeoTransform()
    metadata['pixelWidth'] = mapinfo[1]
    metadata['pixelHeight'] = mapinfo[5]

    metadata['ext_dict'] = {}
    metadata['ext_dict']['xMin'] = mapinfo[0]
    metadata['ext_dict']['xMax'] = mapinfo[0] + dataset.RasterXSize / mapinfo[1]
    metadata['ext_dict']['yMin'] = mapinfo[3] + dataset.RasterYSize / mapinfo[5]
    metadata['ext_dict']['yMax'] = mapinfo[3]

    metadata['extent'] = (metadata['ext_dict']['xMin'], metadata['ext_dict']['xMax'],
                         metadata['ext_dict']['yMin'], metadata['ext_dict']['yMax'])...

By purchasing this solution you'll be able to access the following files:
Solution-part1.py and Solution-part2.py.

$40.00
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats