added resolution argument to mapconverter

Former-commit-id: 0f330b65175f27f4662c8eb56ff7eef105f97ac0
This commit is contained in:
nathan 2020-06-16 18:10:25 -07:00
parent eaf6bc70a8
commit e8cf66ebb9
2 changed files with 29 additions and 8 deletions

View file

@ -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 |

View file

@ -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):