From 810e1180599669506bdaea26b35ce825d4be7ab4 Mon Sep 17 00:00:00 2001 From: "torok.istvan" Date: Sat, 9 May 2026 23:14:18 +0200 Subject: [PATCH] =?UTF-8?q?Hibajav=C3=ADt=C3=A1s:=20CoordConverterService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/main.dart | 3 ++- lib/services/coord_converter_service.dart | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/lib/main.dart b/lib/main.dart index 2f73851..fb6f6de 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -14,7 +14,8 @@ Future main() async { anonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.ewogICJyb2xlIjogImFub24iLAogICJpc3MiOiAic3VwYWJhc2UiLAogICJpYXQiOiAxNzQwMjY1MjAwLAogICJleHAiOiAxODk4MDMxNjAwCn0.4cMVfAnBLxne1lq0fm94rgtXLBJdRx-0f-E4Jd_jFwI'); - await Get.putAsync(() => CoordConverterService().onInit()); + await Get.putAsync( + () => CoordConverterService().init()); runApp(const MyApp()); } diff --git a/lib/services/coord_converter_service.dart b/lib/services/coord_converter_service.dart index c0f7609..faa90dd 100644 --- a/lib/services/coord_converter_service.dart +++ b/lib/services/coord_converter_service.dart @@ -28,6 +28,25 @@ class CoordConverterService extends GetxService { wgsProj = proj4.Projection.WGS84; } + Future init() async { + final bytes = (await rootBundle.load('assets/Grids/etrs2eov_notowgs.gsb')) + .buffer + .asUint8List(); + + proj4.Projection.nadgrid('Etrs2Eov', bytes); + + const def = + '+proj=somerc +lat_0=47.14439372222222 +lon_0=19.04857177777778 ' + '+k_0=0.99993 +x_0=650000 +y_0=200000 +ellps=GRS67 ' + '+towgs84=52.17,-71.82,-14.9,0,0,0,0 ' + '+units=m +nadgrids=Etrs2Eov +no_defs'; + + eovProj = proj4.Projection.add('EPSG:23700', def); + wgsProj = proj4.Projection.WGS84; + + return this; // ← ez a kulcs + } + // Segédmetódusok — nem kötelező, de tisztább proj4.Point wgsToEovPoint(double lon, double lat) => wgsProj.transform(eovProj, proj4.Point(x: lon, y: lat));