[Tex/LaTex] Drawing Indian Flag using tikz

tikz-pgftikz-styles

I am trying to draw an Indian Flag using ideas from here and others including an Ashok-chakra symbol from overleaf example. I want to have the proper coding with correct dimensions mentioned at wikipedia. I have a doubt on the size of Ashok-Chakra. Any one help me please! My MWE is given below:

\documentclass[tikz]{standalone}


\definecolor{saffron}{HTML}{FF9933} % top stripe
\definecolor{white}{HTML}{FFFFFF} % middle stripe
\definecolor{indiegreen}{HTML}{138808} % bottom stripe
\definecolor{navyblue}{HTML}{000080} % ashok chakra

\tikzstyle{bharat}=[draw=navyblue,fill=navyblue]

\begin{document}
\begin{tikzpicture}
    \fill[saffron] (0,400mm) rectangle (900mm,600mm);
    \fill[white] (0,200mm) rectangle (900mm,400mm);
    \fill[indiegreen] (0,0) rectangle (900mm,200mm);
    \node at (450mm,300mm)[scale=0.09]{%
    \begin{tikzpicture}
        \draw[bharat, even odd rule] (0,0) circle (92.5) (0,0) circle (80); 
        \draw[bharat] (0,0) circle (16);
        \foreach \x in {0,..., 23}{
            \draw[bharat] (7.5+15*\x:80) circle (3.5); 
            \draw[bharat, rotate=15*\x] (0,0)--(5.38:32)--(80,0)--(-5.38:32)--cycle; 
        }
    \end{tikzpicture}
    };
\end{tikzpicture}
\end{document}

Output looks like:
enter image description here

Best Answer

To enforce the nine different measurements one can use the .is choice key handler from the pgfkeys stuff. I have reimplemented the flag code (which probably needs more fiddling to get the details of Ashoka Chakra exactly right). Note, that for the larger sizes of the flag, the x and y vectors need to be changed to avoid dimension too large errors:

\documentclass[tikz,border=5]{standalone}
\definecolor{saffron}{HTML}{FF9933}
\definecolor{white}{HTML}{FFFFFF}
\definecolor{indiegreen}{HTML}{138808}
\definecolor{navyblue}{HTML}{000080}
\tikzset{%
  flag width/.store in=\flagwidth,
  flag height/.store in=\flagheight,
  flag size/.style args={#1x#2}{flag width=#1, flag height=#2},
  Ashoka Chakra/.store in=\AshokaChakra,
  size/.is choice,
  size/.cd,
    1/.style={flag size=6300x4200, Ashoka Chakra=1295},
    2/.style={flag size=3600x2400, Ashoka Chakra=740},
    3/.style={flag size=2700x1800, Ashoka Chakra=555},
    4/.style={flag size=1800x1200, Ashoka Chakra=370},
    5/.style={flag size=1350x900, Ashoka Chakra=280},
    6/.style={flag size=900x600, Ashoka Chakra=185},
    7/.style={flag size=450x300, Ashoka Chakra=90},
    8/.style={flag size=225x150, Ashoka Chakra=40},
    9/.style={flag size=150x100, Ashoka Chakra=25},
  /tikz/.cd,
  Flag of India/.pic={%
    \begin{scope}[#1,
    local bounding box/.expanded=\pgfkeysvalueof{/tikz/name prefix}]%
    \foreach \stripecolor [count=\i from 0] in {indiegreen, white, saffron}
      \path [fill=\stripecolor]
      (-\flagwidth/2, \i/3*\flagheight-\flagheight/2)
      rectangle ++(\flagwidth, 1/3*\flagheight);
    \tikzset{scale=\AshokaChakra/2}
    \path [fill=navyblue, even odd rule]
      circle [radius=1] circle [radius=22/25] circle [radius=1/5];
    \foreach \i in {0,...,23}
       \path [fill=navyblue] (15/2+15*\i:22/25) circle [radius=1/20] 
       [rotate=15*\i] (0:0) -- (21/4:1/3) -- (0:7/8)-- (-21/4:1/3)--cycle;
     \end{scope}
 },
 Flag of India/.default={size=9}  
}
\begin{document}
\begin{tikzpicture}[x=1mm, y=1mm]
\coordinate (flag);
\foreach \size in {5,...,9}
  \pic at (flag.south) (flag)
    {Flag of India={size=\size, shift=(270:\flagheight*3/4)}};
\end{tikzpicture}
\end{document}

enter image description here