kopia lustrzana https://github.com/glidernet/ogn-python
Elevation data is easy to import -> now mandatory
rodzic
a67aef730e
commit
c90efb910c
11
README.md
11
README.md
|
@ -57,18 +57,19 @@ For best performance you should use [TimescaleDB](https://www.timescale.com), wh
|
|||
```
|
||||
|
||||
8. Optional: Import world elevation data (needed for AGL calculation)
|
||||
For Europe we can get the DEM as GeoTIFF files from the
|
||||
[European Environment Agency](https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1).
|
||||
Because the spatial reference system (SRID) of these files is 3035 and we want 4326 we have to convert them:
|
||||
8.1 Sources: There are many sources for DEM data. It is important that the spatial reference system (SRID) is the same as the database.
|
||||
8.1.1 The [GMTED2010 Viewer](https://topotools.cr.usgs.gov/gmted_viewer/viewer.htm) provides data for the world. Just download the data you need.
|
||||
8.1.2 For Europe we can get the DEM as GeoTIFF files from the [European Environment Agency](https://land.copernicus.eu/imagery-in-situ/eu-dem/eu-dem-v1.1).
|
||||
Because the SRID of these files is 3035 and we want 4326 we have to convert them:
|
||||
|
||||
```
|
||||
gdalwarp -s_srs "EPSG:3035" -t_srs "EPSG:4326" source.tif target.tif
|
||||
```
|
||||
|
||||
Then we can import the GeoTIFF into the elevation table:
|
||||
8.2 Then we can import the GeoTIFF into the elevation table:
|
||||
|
||||
```
|
||||
raster2pgsql -c -C -I -M -t 100x100 elevation_data.tif public.elevation | psql -d ogn
|
||||
raster2pgsql -s 4326 -c -C -I -M -t 100x100 elevation_data.tif public.elevation | psql -d ogn
|
||||
```
|
||||
|
||||
There is also a [Vagrant](https://www.vagrantup.com/) environment for the development of ogn-python.
|
||||
|
|
|
@ -21,6 +21,7 @@ def update_entries(session, start, end, logger=None):
|
|||
# considered time interval should not exceed a complete day
|
||||
if end - start > timedelta(days=1):
|
||||
logger.warn("timeinterval start='{}' and end='{}' is too big.".format(start, end))
|
||||
return
|
||||
|
||||
# check if we have any airport
|
||||
airports_query = session.query(Airport).limit(1)
|
||||
|
@ -133,6 +134,6 @@ def update_entries(session, start, end, logger=None):
|
|||
result = session.execute(ins)
|
||||
session.commit()
|
||||
insert_counter = result.rowcount
|
||||
logger.warn("Inserted {} TakeoffLandings".format(insert_counter))
|
||||
logger.info("Inserted {} TakeoffLandings".format(insert_counter))
|
||||
|
||||
return "Inserted {} TakeoffLandings".format(insert_counter)
|
||||
|
|
|
@ -130,10 +130,11 @@ def update_aircraft_beacons(postfix):
|
|||
quality = CASE WHEN ab.location IS NOT NULL AND r.location IS NOT NULL AND ST_DistanceSphere(ab.location, r.location) > 0 AND ab.signal_quality IS NOT NULL
|
||||
THEN CAST(signal_quality + 20*log(ST_DistanceSphere(ab.location, r.location)/10000) AS REAL)
|
||||
ELSE NULL
|
||||
END
|
||||
END,
|
||||
agl = CAST(ab.altitude - ST_Value(e.rast, ab.location) AS REAL)
|
||||
|
||||
FROM devices AS d, receivers AS r
|
||||
WHERE ab.device_id IS NULL and ab.receiver_id IS NULL AND ab.address = d.address AND ab.receiver_name = r.name;
|
||||
FROM devices AS d, receivers AS r, elevation AS e
|
||||
WHERE ab.device_id IS NULL and ab.receiver_id IS NULL AND ab.address = d.address AND ab.receiver_name = r.name AND ST_Intersects(e.rast, ab.location);
|
||||
""".format(postfix))
|
||||
db.session.commit()
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue