Making a square centered at a point in TikZ

Im a newbie to TikZ, so this question may seem stupid. Im a looking at a facility location problem in the plane where I have generated some data points consisting of (x,y)-coordinates for each customer node and each facility node. In the literature, customers nodes are usually marked by a circular dot so I have used the notation

\draw [fill] (x,y) circle [radius=0.05];


for some point specified by (x,y).

The facility nodes are usually marked with a small square. But how do I create a square centered at the point (x,y)? I have looked at rectangle function. But as I have the center point, this approach does not seem to be the right way to go. Can anyone help me here?

-

For this application, I would recommend to use the \draw plot [<options>] coordinates {<coordinate list>}; functionality. If you load \usetikzlibrary{plotmarks}, you have access to a variety of different marks, including filled or empty squares, and it's really easy to provide the coordinates.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{plotmarks}

\begin{document}
\begin{tikzpicture}
\draw [very thin, lightgray] (0,0) grid (4,4);
\draw [cyan] plot [only marks, mark=square*] coordinates {(1,1) (2,3) (2.5,2)};
\draw [orange] plot [only marks, mark size=2.5, mark=*] coordinates {(0,0.5) (1,1.5) (1,2.5) (2,1) (4,2)};
\end{tikzpicture}
\end{document}

-
The little problem with marks, when you want to scale the picture, you scale the marks. For example if xand yare different, the marks lok not fine. It's not always desired. I don't know if it's possible to avoid this feature. It's a problem in geometry with points. It would be interesting to altern between marks and nodes or coordinates. –  Alain Matthes Jun 7 '12 at 14:31
You can make the plot mark size independent of the scale by putting \makeatletter \def\pgfuseplotmark#1{\pgftransformresetnontranslations\csname pgf@plot@mark@#1\endcsname} \makeatother into your preamble. –  Jake Jun 7 '12 at 14:55
Thanks very useful! Perhaps it is a good idea that I ask the question for other users. It's interesting to know this feature. –  Alain Matthes Jun 7 '12 at 15:01

To complete Jake's answer, other possibilities are :

\documentclass{article}
\usepackage{tikz}
\begin{document}

\begin{tikzpicture}
\newcommand\Square[1]{+(-#1,-#1) rectangle +(#1,#1)}
\draw [very thin, lightgray] (0,0) grid (4,4);
\draw (2,3) +(-2pt,-2pt) rectangle +(2pt,2pt) ;
\draw (2,3) \Square{12pt} ;
\end{tikzpicture}
\end{document}


You can use a node and also a coordinate like this

\begin{tikzpicture} [dot/.style={draw,rectangle,minimum size=4mm,inner sep=0pt,outer sep=0pt,thick}]
\draw [very thin, lightgray] (0,0) grid (4,4);
\path (1,1) coordinate[dot] ;
\end{tikzpicture}


With a node :

  \node [rectangle,minimum size=4mm,inner sep=0pt,outer sep=0pt,thick] at (1,1) {};

-