Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Colorisation des nuages de point étroits (largeur ou hauteur < 0.2m) #14

Closed
CharlesGaydon opened this issue Aug 2, 2023 · 1 comment · Fixed by #15
Closed

Colorisation des nuages de point étroits (largeur ou hauteur < 0.2m) #14

CharlesGaydon opened this issue Aug 2, 2023 · 1 comment · Fixed by #15
Labels
bug Something isn't working

Comments

@CharlesGaydon
Copy link
Collaborator

Face à un nuage de point étroit, on obtient des requêtes invalides avec une LARGEUR/HAUTEUR = 0 car un float inférieur à 1 est arrondi à l'unité la plus proche : 0.

Exemple d'une telle requête:
https://wxs.ign.fr/ortho/geoportail/r/wms?LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=text/xml&FORMAT=image/geotiff&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES=&CRS=EPSG:2154&BBOX=1159602.18,6132661.78,1159604.26,6132661.82&WIDTH=10&HEIGHT=0

Ici on voit que la hauteur est de 8cm d'après la bbox.

Solution proposée : imposer un minimum d'un pixel pour avoir une requête valide (cf. la variable URL_SIZE dans color.py)

L'erreur:

Traceback (most recent call last):
  File "/home/CGaydon/repositories/pacasam/./src/pacasam/run_extraction.py", line 56, in <module>
    run_extraction(args)
  File "/home/CGaydon/repositories/pacasam/./src/pacasam/run_extraction.py", line 50, in run_extraction
    extractor.extract()
  File "/home/CGaydon/repositories/pacasam/src/pacasam/extractors/laz.py", line 75, in extract
    self._extract_from_single_file(single_file_path, single_file_sampling)
  File "/home/CGaydon/repositories/pacasam/src/pacasam/extractors/laz.py", line 99, in _extract_from_single_file
    colorize_single_patch(nocolor_patch=Path(tmp_nocolor_patch.name), colorized_patch=colorized_patch, srid=srid)
  File "/home/CGaydon/repositories/pacasam/src/pacasam/extractors/laz.py", line 140, in colorize_single_patch
    color(str(nocolor_patch.resolve()), str(colorized_patch.resolve()), proj=str(srid))
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/pdaltools/unlock_file.py", line 36, in newfn
    return func(*args, **kwargs)
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/pdaltools/color.py", line 144, in color
    download_image_from_geoportail_retrying(proj, "ORTHOIMAGERY.ORTHOPHOTOS", minx, miny, maxx, maxy, pixel_per_meter, tmp_ortho, timeout_second)
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/pdaltools/color.py", line 46, in newfn
    raise err
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/pdaltools/color.py", line 37, in newfn
    return func(*args, **kwargs)
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/pdaltools/color.py", line 83, in download_image_from_geoportail
    req.raise_for_status()
  File "/var/data/CGaydon/mambaforge/envs/pacasam/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: BadRequest for url: https://wxs.ign.fr/ortho/geoportail/r/wms?LAYERS=ORTHOIMAGERY.ORTHOPHOTOS&EXCEPTIONS=text/xml&FORMAT=image/geotiff&SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&STYLES=&CRS=EPSG:2154&BBOX=1159602.18,6132661.78,1159604.26,6132661.82&WIDTH=10&HEIGHT=0
@leavauchier
Copy link
Collaborator

J'ai l'impression que ce serait même mieux de faire un ceil au lieu d'un int (vu que le int équivaut un floor dans notre cas) dans la requête pour ne pas risquer d'avoir une mauvaise colorisation sur les bandes avec le plus grand x et le plus grand y. Mais il me manque peut-être du contexte, @gliegard tu confirmes que ça ne poserait pas de problème de modifier ce comportement ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants