Projet

Général

Profil

Support #39197

opengis: précsions des BBOX (python3)

Ajouté par Emmanuel Cazenave il y a environ 4 ans. Mis à jour il y a environ 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
23 janvier 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Non
Planning:
Non

Description

Dans le connecteur il y a http://git.entrouvert.org/passerelle.git/tree/passerelle/apps/opengis/models.py#n212, qui se comporte différemment en terme de précision en py2/py3 parce que :

Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> res = float('532556.8967346525')
>>> str(res)
'532556.896735'
Python 3.7.3 (default, Apr  3 2019, 05:39:12)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> res = float('532556.8967346525')
>>> str(res)
'532556.8967346525'

Où on note un arrondi en py2 qui n'a pas lieu en py3, des tests qui échouent en py3 genre :

assert mocked_get.call_args[1]['params']['BBOX'] == '539339.67158,5741338.06856,539951.167806,5741949.56478'

De là l'idée de fixer une précision, utiliser genre "{:.6f}".format(res) plutôt que "%s" % res, mais comment fixer cette précision au juste ? (rechercher 'BBOX précision' sur le oueb ne m'aide pas donc je me tourne vers l'expert.

Révisions associées

Révision 498a704c (diff)
Ajouté par Emmanuel Cazenave il y a environ 4 ans

opengis: force coordinates precision to six digits (#39197)

Historique

#2

Mis à jour par Frédéric Péters il y a environ 4 ans

  • Statut changé de Information nécessaire à Fermé

Formats disponibles : Atom PDF