-
Notifications
You must be signed in to change notification settings - Fork 9
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
rewrite function get_altitude_intersection #10
rewrite function get_altitude_intersection #10
Conversation
Codecov ReportPatch coverage is
📢 Thoughts on this report? Let us know!. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A priori, il faudrait reformater le fichier avec Black car le check correspondant de la PR ne passe pas : https://github.com/PnX-SI/RefGeo/pull/10/checks
J'ai juste rajouter un commentaire concernant la simplification et l'amélioration de la lecture du SQL (forme) mais sinon tout me semble ok sur le fond.
-- Use dem | ||
RETURN QUERY | ||
SELECT min((altitude).val)::integer AS altitude_min, max((altitude).val)::integer AS altitude_max | ||
FROM ( | ||
SELECT public.ST_Intersection( | ||
rast, | ||
public.ST_Transform(myGeom, thesrid) | ||
) as altitude | ||
FROM ref_geo.dem AS altitude | ||
WHERE public.ST_Intersects(rast,public.ST_Transform(myGeom,thesrid)) | ||
) AS a; | ||
-- Use dem_vector | ||
ELSE | ||
RETURN QUERY | ||
WITH d as ( | ||
SELECT public.ST_Transform(myGeom,thesrid) a | ||
) | ||
SELECT min(val)::int as altitude_min, max(val)::int as altitude_max | ||
FROM ref_geo.dem_vector, d | ||
WHERE public.ST_Intersects(a,geom); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Je ne suis pas certain que tous les alias présent dans les requêtes de cette section de code soit vraiment nécessaire. Cela vaudrait le coup de les supprimer s'ils sont inutiles afin de simplifier les requêtes.
Au passage, passer tous les "as" restant en majuscule "AS" serait mieux.
J'ai testé et ça fonctionne super ! Merci beaucoup ! Serait-il possible de passer |
LIMIT 1 | ||
INTO is_vectorized; | ||
|
||
IF is_vectorized IS NULL THEN |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Voir la possibilité d'ajouter un sous cas lorsque les géometries sont de type point :
IF is_vectorized IS NULL AND st_geometrytype(myGeom) = 'ST_Point' THEN
RETURN QUERY
WITH alt AS (
SELECT st_value(rast, public.st_transform(myGeom,thesrid))::int altitude
FROM ref_geo.dem AS altitude
WHERE public.st_intersects(rast,public.st_transform(myGeom,thesrid))
)
SELECT min(altitude) AS altitude_min, max(altitude) AS altitude_max
FROM alt;
ELSIF is_vectorized IS NULL THEN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui, intéressant. A priori bien plus performant ?
6c386eb
to
f459a48
Compare
72bdde3
to
74617d9
Compare
f459a48
to
150f793
Compare
Corrige PnX-SI/RefGeo/issues/9 et PnX-SI/GeoNature#2044