2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2026-05-11 09:35:23 +01:00

now calleable from Django

This commit is contained in:
2026-05-10 14:34:22 +01:00
parent 873034b8b8
commit d173ed2a64
3 changed files with 16 additions and 3 deletions
+1 -1
View File
@@ -102,7 +102,7 @@ def generate_performance_test(num_points=200):
return test_points
def export_random_points_gpx(points_with_results, filename="random_test_points.gpx"):
def export_random_points_gpx(points_with_results, filename="/tmp/random_test_points.gpx"):
root = ET.Element("gpx", version="1.1", creator="PerformanceTester",
xmlns="http://www.topografix.com/GPX/1/1")
+14 -1
View File
@@ -99,7 +99,20 @@ def split_into_monotonic_segments(points):
def generate_boundary_segments():
points = load_and_clean_gpx('1623-6_border.gpx')
filename = '1623-6_border.gpx'
# Check if we are running inside Django
try:
from django.conf import settings
# If settings is configured, use the troggle path
if hasattr(settings, 'TROGGLE_PATH'):
gpx_path = Path(settings.TROGGLE_PATH) / 'core' / filename
else:
gpx_path = Path(filename)
except (ImportError, Exception):
# Fallback for standalone testing outside of Django
gpx_path = Path(filename)
points = load_and_clean_gpx(gpx_path)
# save_cleaned_gpx(points, "cleaned_border_output.gpx") # done once, not needed
mono_segments = split_into_monotonic_segments(points)
File diff suppressed because one or more lines are too long