From ab30927193cd2305978411ffe23e4c7041fb0d91 Mon Sep 17 00:00:00 2001 From: rldhont Date: Wed, 11 Sep 2024 13:53:17 +0200 Subject: [PATCH] Fix: IGN sampling value --- altiProfil/install/www/altiprofil/js/altiProfil.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/altiProfil/install/www/altiprofil/js/altiProfil.js b/altiProfil/install/www/altiprofil/js/altiProfil.js index e8c6b3a..f456180 100755 --- a/altiProfil/install/www/altiprofil/js/altiProfil.js +++ b/altiProfil/install/www/altiprofil/js/altiProfil.js @@ -77,6 +77,9 @@ function getProfil(p1,p2){ p2Point.transform(fromProjection, toProjection); } + var distance = Math.round(p1.distanceTo(p2)); + var sampling = Math.round(distance <= 100 ? distance - 2 : (distance <= 500 ? distance / 5 : distance / 25)); + var qParams = { 'p1Lon': p1Point.lon, 'p1Lat': p1Point.lat, @@ -85,8 +88,8 @@ function getProfil(p1,p2){ 'srs': lizMap.map.projection.projCode, 'repository': lizUrls.params.repository, 'project': lizUrls.params.project, - 'sampling' : Math.round(p1.distanceTo(p2)/25) /* Only use with french mapping Agency (IGN) web service */, - 'distance' : Math.round(p1.distanceTo(p2)) + 'sampling' : sampling /* Only use with french mapping Agency (IGN) web service */, + 'distance' : distance } getProfilJsonResponse(qParams, function(data){