Browse Source

Exclude bogus lat/lon

pull/74/head
squeaky otter 1 year ago
parent
commit
3282fa9fe6
Signed by: dashie GPG Key ID: C2D57B325840B755
3 changed files with 6 additions and 3 deletions
  1. +4
    -2
      backend/lib/pyairwaves/redis_eater.ex
  2. +1
    -1
      backend/lib/pyairwaves_web/templates/archive/sources_coverage.html.eex
  3. +1
    -0
      config.py.sample

+ 4
- 2
backend/lib/pyairwaves/redis_eater.ex View File

@ -29,8 +29,8 @@ defmodule Pyairwaves.RedisEater do
case Jason.decode(message) do
{:ok, msg} ->
# TODO: Broadcast only if lat and lon are available
if msg["lat"] == 91.0 or msg["lon"] == 181.0 do
# bogus datas
if msg["lat"] >= 91.0 or msg["lat"] <= -91.0 or msg["lon"] >= 181.0 or msg["lon"] <= -181.0 do
# bogus datas if anything not in -90/90 or -180/180
{:noreply, state, :hibernate}
else
Phoenix.PubSub.broadcast(
@ -68,6 +68,8 @@ defmodule Pyairwaves.RedisEater do
bearing: bearing,
distance: distance
}
# IO.inspect(coverage)
# IO.inspect(msg)
Pyairwaves.States.SourceCoverage.add(source.id, coverage)
# IO.inspect(Pyairwaves.States.SourceCoverage.find(source.id))


+ 1
- 1
backend/lib/pyairwaves_web/templates/archive/sources_coverage.html.eex View File

@ -38,7 +38,7 @@ function fixPoints(points) {
<div class="col-md-2 source_coverage">
<div class="header_source_coverage">
<h3><%= source.name %>, <%= source.type %></h3>
<small>updated on <%= source.coverage_updated_at || "never" %></small>
<small>updated on <time datetime="<%= source.coverage_updated_at %>"><%= source.coverage_updated_at || "never" %></time></small>
</div>
<div id="polar-<%= source.name %>" class="chart" width="100%"></div>
<script>


+ 1
- 0
config.py.sample View File

@ -11,6 +11,7 @@ PYAW_HOSTNAME = 'potato'
# Port for ADSB (dump1090) needs to be 30003 (SBS BaseStation)
# Port for AIS (rtl-ais) needs to be 10110
# See docs/PubSub_structure.md for the value of (src)PosMode
# Please note that the lat/lon of sources is public, you might want to use a lat/lon a bit away from your real location, or use town center, etc.
ADSB_SOURCE = {"host": "patate", "port": 30003, "name": "patate", "posMode": 0, "lon": None, "lat": None, "reconnect_delay": 5, "thread_timeout": 30}
AIS_SOURCE = {'host': 'patate', 'port': 10110, "name": "patate", "posMode": 0, "lon": None, "lat": None, "reconnect_delay": 5, "thread_timeout": 30}


Loading…
Cancel
Save