diff --git a/analyse-bano.sh b/analyse-bano.sh index 4408a8e..e7a001b 100755 --- a/analyse-bano.sh +++ b/analyse-bano.sh @@ -164,23 +164,25 @@ SET max_parallel_workers_per_gather TO 0; select * from ( select case when id is null - then format('', - st_geohash(geom),lat,lon,voie_cadastre,fantoir) + then format('', + subclass,st_geohash(geom),lat,lon,voie_cadastre,fantoir) when id_noname is not null and id_noname not like '%,%' and (l_geom-l_ways_noname<100) and ((l_noname > 0.5 and l2_noname<100) or (l_noname > 0.75)) and upper(voie_cadastre)!=voie_cadastre - then format('', - lat,lon,voie_cadastre,fantoir,id_noname,id_noname,voie_cadastre) + then format('', + subclass,lat,lon,voie_cadastre,fantoir,id_noname,id_noname,voie_cadastre) when id is not null and id not like '%,%' and (l_geom-l_ways<100) and ((l > 0.5 and l2 < 100) or (l>0.75)) and names is null and upper(voie_cadastre)!=voie_cadastre - then format('', - lat,lon,voie_cadastre,fantoir,id,id,voie_cadastre) + then format('', + subclass,lat,lon,voie_cadastre,fantoir,id,id,voie_cadastre) when id is not null and id not like '%,%' and (l_geom-l_ways<100) and ((l > 0.5 and l2 < 100) or (l>0.75)) and names is not null and upper(voie_cadastre)!=voie_cadastre - then format('', - lat,lon,voie_cadastre,fantoir,id,names,id,voie_cadastre,id,fantoir) + then format('', + subclass,lat,lon,voie_cadastre,fantoir,id,names,id,voie_cadastre,id,fantoir) when names ~* replace(replace(voie_cadastre,'(',''),')','') then '' - else format('', - lat,lon,voie_cadastre,fantoir) + else format('', + subclass,lat,lon,voie_cadastre,fantoir) end as er from ( - select round(st_x(st_transform(st_centroid(geom),4326))::numeric,6) as lon, round(st_y(st_transform(st_centroid(geom),4326))::numeric,6) as lat, st_transform(st_centroid(geom),4326), + select + abs(('x'||md5(coalesce(nom_voie, replace(voie_cadastre,E'\x22','')) || f.fantoir || ST_AsText(geom)))::bit(64)::bigint) AS subclass, + round(st_x(st_transform(st_centroid(geom),4326))::numeric,6) as lon, round(st_y(st_transform(st_centroid(geom),4326))::numeric,6) as lat, st_transform(st_centroid(geom),4326), replace(voie_cadastre,E'\x22','') as voie_cadastre, f.fantoir, replace(names,E'\x22','') as names, id, id_noname, st_length(st_intersection(ways,st_buffer(geom,20)))/st_length(ways) as l, st_length(st_transform(ways,4326)::geography)-st_length(st_transform(st_intersection(ways,geom),4326)::geography) as l2,