look into mongoDB's geospatial indexing, don't reinvent the wheel.
Regardless, that's all Euclidean. Human perception of color follows the CieLAB non-metric. (It's basically just a function of two variables, since it satisfies neither the triangle inequality nor symmetry.)