Space filling curve with locality for odd column/row count First of all: I don't have a mathematical background, I'm looking for something I can eventually implement in software.
What I'm looking for is a space filling cure with locality, like the hilbert curve, but one instead that can also handle odd number of rows/pixels. E.g. hilbert curve requires powers of two (2x2, 256x256, etc) and I would like one that also works with 81x81 or 59x59, you get the drift.
 A: Comment
Actually the minimum square that can contain an iteration of Hilbert's curve has an odd number of pixels on each side:
### ###
# # # #
# ### #
#     #
### ###
  # #
### ###

So I assume you are actually thinking of a grid of cells, and one long path through all the cells exactly once each, such that the displacement between two points on the path is bounded by a constant times the grid side length times the fraction of the total number of cells traversed.
Solution
I don't see an easy way to use Hilbert's curve, but there is another space-filling curve that is easy to use. Here is the basic structure (O represents an endpoint and a line represents a connection):
O  .  O-O
 \ . / . \
  O.O  .  O
..|.|.....|
  O.O  .  O
 / . \ . /
O  .  O.O
|.....|.|..
O  .  O.O
 \ . / . \
  O-O  .  O

Notice that the whole region is divided into $3 \times 3$ smaller regions of roughly equal size, and if each can be completed using a suitable path with endpoints at opposite corners, then connecting those $9$ paths according to the the above construction will produce a suitable path for the whole region. But it is impossible to find such a path for any region with length and width both even, and to avoid that case we would need to first use a reduction to make either the length or width odd, and then ensure that on each division the $9$ smaller regions are also of the same nature, which is possible because the odd side can always be divided into $3$ odd parts unless it is $1$.
Reduction
Let $m,n$ be the dimensions of the original grid
If $m$ is odd or $n$ is odd:
  The above solution works
If $m,n$ are both even:
  $m,n$ can each be divided into $2$ odd parts of roughly equal size
  Divide the original grid into $2 \times 2$ regions accordingly and use the following structure:
  O-O
 / . \
O  .  O
|.....|
O  .  O
 \ . /
  O-O

  Now each small region has odd length and width, and the above solution works on each of them
Base cases
The base cases for the above recursive solution are all trivial, being of dimensions $(1,k)$ for some integer $k$.
Proof of locality
This is left as an exercise, but intuitively the recursive structure ensures that to move between any two nonadjacent regions at any level requires traversing an entire region at that level.
A: I do not have a strong mathematical background neither, but I think that the following trick would work: you have to consider a $59 \times 59$ grid as a multilevel refined grid. Here is an example how to achieve a $5 \times 5$ grid:

Then you put a multilevel hilbert curve (or a multilevel z-curve: see image) on this grid and you have your SFC on an odd column/row count. I know that your grid is regular, but you use the irregular grid (square with different sizes) to do your numbering, and you map this irregular grid to your original grid keeping the same numbering.
