From e8cf66ebb95a0aa598ae0090d4f5f5a1e28a2897 Mon Sep 17 00:00:00 2001 From: nathan Date: Tue, 16 Jun 2020 18:10:25 -0700 Subject: [PATCH] added resolution argument to mapconverter Former-commit-id: 0f330b65175f27f4662c8eb56ff7eef105f97ac0 --- README.md | 22 ++++++++++++++++++---- mapconverter.py | 15 +++++++++++---- 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index b5924b9..2651338 100644 --- a/README.md +++ b/README.md @@ -10,12 +10,12 @@ There are a lot of missing pieces in this implementation so far: ### BUILDING -Tested and working on Ubuntu 18.04, Raspbian Stretch / Buster, Windows Subsystem for Linux (with Ubuntu 18.04) +Tested and working on Ubuntu 18.04, Raspbian Stretch / Buster, Windows Subsystem for Linux (with Ubuntu 18.04), and Mac 0. Install build essentials ``` -sudo apt-get install build-essentials +sudo apt-get install build-essential ``` 1. Install SDL and RTL-SDR libararies @@ -43,7 +43,21 @@ pip3 install lxml numpy tqdm ./getmap.sh ``` -3. (optional for Windows) +The mapconverter script called by getmap.sh downsamples the file to render resonably quickly on a Raspberri Pi 4. If you are on a slower device (e.g, a Raspberry Pi 3), you may want to try something like: + +``` +python3 mapconverter.py --resolution 64 all.svg +``` + +On the other hand, if you are on a modern desktop or laptop, you can use something higher (but you probably don't need the full 6 digit precision of the McCurley SVG file): + + +``` +python3 mapconverter.py --resolution 8192 all.svg +``` + + +3. (Windows only) As WSL does not have an X server built in, you will need to install a 3rd party X server, such as https://sourceforge.net/projects/vcxsrv/ @@ -79,7 +93,7 @@ viz1090 will open an SDL window set to the resolution of your screen. | --metric | Display metric units | | --lat | Specify your latitude in degrees | | --lon | Specify your longitiude in degrees | -| --screensize [width] [height] | Specify a specific resolution to pass to SDL_RenderSetLogicalSize, otherwise use resolution of display | +| --screensize [width] [height] | Specify a resolution, otherwise use resolution of display | | --uiscale [scale] | Scale up UI elements by integer amounts for high resolution screen | | --fullscreen | Render fullscreen rather than in a window | diff --git a/mapconverter.py b/mapconverter.py index 4b807ff..63f707f 100644 --- a/mapconverter.py +++ b/mapconverter.py @@ -2,15 +2,21 @@ from lxml import etree as ElementTree import numpy as np import sys from tqdm import tqdm +import argparse -filename = sys.argv[1] +parser = argparse.ArgumentParser(description='viz1090 SVG Map Converter') +parser.add_argument("--resolution", default=250, type=int, nargs=1, help="downsample resolution") +parser.add_argument("file", nargs=1, help="filename") -if(len(filename) == 0): +args = parser.parse_args() + + +if(len(args.file) == 0): print("No input filename given") exit() parser = ElementTree.XMLParser(recover=True) -tree = ElementTree.parse(filename, parser) +tree = ElementTree.parse(args.file[0], parser) polys = tree.xpath('//polygon') bin_file = open("mapdata.bin", "wb") @@ -18,7 +24,8 @@ bin_file = open("mapdata.bin", "wb") outlist = [] -resolution = 250 +resolution = args.resolution[0] + print("Reading points") for i in tqdm(range(len(polys))): #for i in range(40):