FAI-CIVL / FAI-Airscore

AirScore - online paragliding / hanggliding GAP-based scoring software.
https://airscore.cc/
GNU General Public License v3.0
13 stars 17 forks source link

Forbes Airspace not compatible #166

Closed kuaka closed 3 years ago

kuaka commented 3 years ago

Clicking "Area map | download" in forbes (airscore_fai db) /region_map/36?compid=53 results in 500 error. I believe that the airspace file is not what was expected:

airscore_prod | File "/home/sid/.local/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request airscore_prod | return self.view_functionsrule.endpoint airscore_prod | File "/app/airscore/public/views.py", line 553, in region_map airscore_prod | waypoints, reg_map, airspacelist, = frontendUtils.get_region_waypoints(regid, region=region) airscore_prod | File "/app/airscore/core/frontendUtils.py", line 1422, in get_region_waypoints airscore_prod | openair_file, airspace_layer, airspacelist, = create_airspace_layer(reg_id, region=region, openair_file=openair_file) airscore_prod | File "/app/airscore/core/mapUtils.py", line 387, in create_airspace_layer airscore_prod | data = read_airspace_map_file(openair_file) airscore_prod | File "/app/airscore/core/airspaceUtils.py", line 314, in read_airspace_map_file airscore_prod | create_airspace_map_check_files(openair_filename) airscore_prod | File "/app/airscore/core/airspaceUtils.py", line 269, in create_airspace_map_check_files airscore_prod | bbox = get_airspace_bbox(reader_2) airscore_prod | File "/app/airscore/core/mapUtils.py", line 78, in get_airspace_bbox airscore_prod | for element in record['elements']: airscore_prod | TypeError: 'NoneType' object is not subscriptable

biuti commented 3 years ago

Is it possible that the region has an openair file associated that is not in data folder?

with https://github.com/FAI-CIVL/FAI-Airscore/commit/c59f64d109669f26f50aecd02f697de8ee669505 it has been added a fallback if region has an openair file associated but file is missing.

kuaka commented 3 years ago

This is a compatibility issue of the fil. Available in the link above. Will error when you upload it I believe. Or at least if you try to draw the map.

biuti commented 3 years ago

Ok probably I found the problem. As we are using aero files library I'll try to find a workaround. When adding a region with openair file, I'll check file, if not valid I'll try to patch, otherwise I'll import only wpts. Meanwhile I'll create map anche check files directly, as that is the way to check file. The problem seems to be double spaces in fixes lines.

kuaka commented 3 years ago

as joerg said there is no standard for openair files. So there will always probably be the possibility that some files are not compatible. However it would be good to have a collection of files to test with.

biuti commented 3 years ago

I just pushed an updated import function: https://github.com/FAI-CIVL/FAI-Airscore/commit/14128907d8ae0001674b692625c26cc37b8cb20f

I tested with Forbes and some other openair files I have, but I'll flag to test