function show_similar(idx)
   % Display similar images to idx S³ of path
   data=get(groot,"UserData");
   ref=data.ref(idx);
   lat=ref.lat;
   lon=ref.lon;
   N=length(lat);
   idx1=fix(N/3);
   idx2=fix(2*N/3);
   fstring=['SELECT * FROM tmp WHERE tmp.cnt_id IN (SELECT cnt_id FROM rtr WHERE xmin<=%15.10f ',...
       ' AND %15.10f <= xmax AND ymin<= %15.10f ',...
       ' AND  %15.10f <= ymax ) AND abs(yawc - %15.10f) <  20.0* 3.1415/180.0;'];
   if lat(idx1) < lat(idx2)
       [lati,lata]=deal(lat(idx1),lat(idx2));
   else
       [lata,lati]=deal(lat(idx1),lat(idx2));
   end   
   if lon(idx1) < lon(idx2)
       [loni,lona]=deal(lon(idx1),lon(idx2));
   else
       [lona,loni]=deal(lon(idx1),lon(idx2));
   end         
   sql=string(sprintf(fstring,lati,lata,loni,lona,ref.yawc));
   conn=sqlite(data.db_file);
   other=fetch(conn,sql);
   close(conn);
   if isempty(other)
       return
   end
   di=[];
   for idx=1:size(other,1)
       di=[di,norm([ref.latc,ref.lonc]-[other.latc(idx),other.lonc(idx)])];
   end
   [~,iss]=sort(di);
   ok=zeros(size(data.S,1),1);
   to_del=[];
   for idx=1:length(iss)
       ref_=get_part_id(other.cnt_id(iss(idx)));
       if ok(ref_)<1
           ok(ref_)=ok(ref_)+2;
       else
           to_del=[to_del,iss(idx)];
       end
   end
   other([to_del],:)=[];
   di([to_del])=[];
   [~,iss]=sort(di);

   % Display results
   show_primary_sss(ref,9);
   for kdx=1:length(iss)
      show_secondary_sss_part(data,other(iss(kdx),:),9+kdx,19+kdx);
   end
   set(1,"Position",[100,322,560,420]);
   set(9,"Position",[735,310,700,654]);
   for idx=1:length(iss)
     if ishandle(9+idx)
        set(9+idx,'Position',[1600+(idx-1)*700,-400,694,654]);
     end
     if ishandle(19+idx)
        set(19+idx,'Position',[1600+(idx-1)*700,700,560,420]);
     end
   end
end

