mipastgt / AIPBrowserDE-Public

Public issues and discussions site for the AIPBrowserDE
1 stars 0 forks source link

command line parameters and batch-mode #18

Open FelixTux opened 2 weeks ago

FelixTux commented 2 weeks ago

I mainly use AIPBrowserDE as a trip kit generator under Linux. With the web tool geojson.io I click together e.g. a corridor, which is then saved as a WKT file. A Python script then creates a trip-kit.json configuration file for me from this file and a template. I start AIPBrowserDE, load the json file and get my trip kit. It would be great if I could pass the trip-kit.json configuration file to AIPBrowserDE via command line parameters and the corresponding trip kit would then be created in batch mode. Then I could also export prepared routes that I fly frequently automatically. Or I could create my own website for when I'm on the fly. I could then upload the WKT file to this Page to get a trip-kit.

mipastgt commented 2 weeks ago

I just did some experiments and this seems to be doable. I don't have a Linux box running but I think my Mac is similar enough. With

mpaus@ip8-4 ~ % /Applications/AIP\ Browser\ DE.app/Contents/MacOS/AIP\ Browser\ DE --defaultLogLevel warn --logToFile false --batchMode true 
Executing AIP Browser DE in batch mode.
mpaus@ip8-4 ~ % 

I can run the application via the command line and control its behaviour via command line parameters. The parameter --batchMode true makes the app run in batch mode, i.e., the app is not showing any GUI. This could be extended with something like --tripKit "path to trip-kit config file" to create a corresponding trip kit. The output path for the trip-kit can be configured in the trip-kit config file itself. Would that be what you would like to see and would this work with Linux too? I am not so familiar with starting Linux GUI apps via the command line.

mipastgt commented 2 weeks ago

I works. I just generated the first trip-kit in batch mode.

mpaus@ip8-4 ~ % /Applications/AIP\ Browser\ DE.app/Contents/MacOS/AIP\ Browser\ DE --defaultLogLevel error --logToFile false --exportTripKit ~/AIPBrowserDE-Export/trip-kit-config-AIP-VFR-refs-only-native.json
trip-kit-config-AIP-VFR-refs-only-native: 1 Exporting page for 'GEN 4-9'
trip-kit-config-AIP-VFR-refs-only-native: 2 Exporting page for 'GEN 4-10'
trip-kit-config-AIP-VFR-refs-only-native: 3 Exporting page for 'GEN 4-11'
trip-kit-config-AIP-VFR-refs-only-native: 4 Exporting page for 'ENR 6.ol'
trip-kit-config-AIP-VFR-refs-only-native: 0 Creating ZIP file ...
trip-kit-config-AIP-VFR-refs-only-native: 0 The selected charts and pages where exported to: '/Users/mpaus/AIPBrowserDE-Export/AIP-VFR-References-Native.zip'.
mpaus@ip8-4 ~ % 
FelixTux commented 2 weeks ago

Thank you for your support, I tried it. Apparently this function does not exist under Linux. I use version 1.0.2 AIP\ Browser\ DE --help Usage: AIPBrowserDE options_list Options: --logToFile [true] -> Write logs into a file. { Value should be one of [true, false] } --defaultLogLevel [info] -> Default log level. { Value should be one of [trace, debug, info, warn, error, off] } --help, -h -> Usage info

mipastgt commented 2 weeks ago

Of course not because I just implemented that today :-) I'll make a preview availabe shortly.

FelixTux commented 2 weeks ago

Great. That would also work with Linux. I am looking forward to the update.

mipastgt commented 2 weeks ago

You can now try the latest preview here:

Linux: https://mpmediasoft.de/products/AIPBrowserDE/preview/AIP%20Browser%20DE-1.2.0-b04-linux-x86_64.deb

Mac: https://mpmediasoft.de/products/AIPBrowserDE/preview/AIP%20Browser%20DE-1.2.0-b04-osx-x86_64.dmg

Attention: The links above where updated to the latest version!

FelixTux commented 2 weeks ago

Works perfectly for me. This is exactly what I wanted and that went really quickly. Thank you very much.

mipastgt commented 2 weeks ago

Your are welcome :-).

I have one more feature in the pipeline. In the future you will be able to specify the covered area in the trip-kit config file like this:

"coveredArea": [
    {
        "type": "GeoJsonGeometry",
        "geoJsonFile": "my coverd area file.geojson"
    }
]

I.e., the covered area can be directly defined by referencing a GeoJson file which could, e.g., be created via geojson.io.

mipastgt commented 2 weeks ago

Graphical editing of the covered area of a trip-kit

The website geojson.io lets you create and edit a geographical area and save it to a GeoJSON file. This file can now be directly used to specify the covered area in a trip-kit configuration file.

The first image shows the generation of the area via geojson.io.

area_definition_in_geojson io

The following trip-kit configuration file uses the so generated file which was saved as trip-kit-area-bounds.geojson.

{
    "version": "1.0.3",
    "name": "Flying in a geojson area",
    "description": "Flying in an area defined by a geojson file exported from geojson.io.",
    "charts": {
        "coveredArea": [
            {
                "type": "GeoJsonGeometry",
                "geoJsonFile": "trip-kit-area-bounds.geojson"
            }
        ]
    }
}

The second image shows the content of the file covered_charts_area.geojson which was created as part of the trip-kit generation. (The chosen geometry may not make much sense here but it shows the possibilities.)

covered_charts_area_in_geojson io

Attention:

  1. The file trip-kit-area-bounds.geojson must be placed in the output directory where the trip-kit will be generated. The default would be the standard output directory of the AIP Browser DE.
  2. The links to the software above where updated to a new version.
FelixTux commented 2 weeks ago

It works the same on my Linux system. I was able to generate a charts-trip-kit using a geojson file in batch-mode. A pages-trip-kit didn't work. Surely you haven't implemented it yet and I'm probably just too impatient again:-)

mipastgt commented 2 weeks ago

I just ran this trip-kit configuration and it worked:

{
    "version": "1.0.3",
    "name": "Flying in a geojson area",
    "description": "Flying in an area defined by a geojson file exported from geojson.io.",
    "charts": {
        "coveredArea": [
            {
                "type": "GeoJsonGeometry",
                "geoJsonFile": "trip-kit-area-bounds.geojson"
            }
        ]
    },
    "pages": {
        "coveredArea": [
            {
                "type": "GeoJsonGeometry",
                "geoJsonFile": "trip-kit-area-bounds.geojson"
            }
        ]
    }
}

Could you please tell me what went wrong in your case and what did the config file look like?

FelixTux commented 2 weeks ago

covered_pages_test: 0 The selected charts and pages where exported to: '/home/user/AIPBrowserDE-Export/test_2'.

./test_2/pages/test_2.pdf is missing

map.geojson: {"type":"FeatureCollection","features":[{"type":"Feature","properties":{},"geometry":{"coordinates":[[8.88567624205848,54.50158079012621],[9.19451460529126,54.187085067333186],[9.670722723303271,54.258887167646236],[9.59632010573884,53.92940513110261],[9.745136878156416,53.64145657000253]],"type":"LineString"}}]}

covered_pages_test.json: { "version": "1.0.2", "name": "test_2", "description": "Trip-Kit 'test_2' generiert am 2024-06-17", "type": "NATIVE", "exportDir": "./", "noZIP": "true", "pages": { "coveredArea": [ { "type": "GeoJsonGeometry", "geoJsonFile": "map.geojson", "distance": 30000.0 } ] "pageFormat": "pdf", "asSingleFile": "true", "useICAOSubdirs": "false" } }

mipastgt commented 2 weeks ago

Ahh, there is a misunderstanding. In the case of the GeoJsonGeometry there is no parameter distance because it is assumed, that the given geometry already is an area. You can see that in my example above. In your case the geometry is just a polyline which by itself does not define an area. Maybe there should have been an error message because of the unexpected distance parameter but I use a somewhat relaxed JSON parsing which just ignores unknow parameters for backward compatibility.

mipastgt commented 2 weeks ago

I modified the code slightly so that your above example does work now too. See new software version above. The logic now is that if the provided geometry is just a LineString or a feature collection containing only a LineString, then the optional parameter distance is applied. Otherwise the geometry is just treated as an area as before.

For your track definition above

track_definition_in_geojson io

I get the following result when the buffer distance is applied to the track and the pages associated with this area are generated.

covered_charts_area_in_geojson io