-1

I am working on a geospacial service and using Hilbert Curves to convert latitude and longitude to a Quadtree Key.

For example, At level 30:
45.5337699,-122.6988316 converts to 2/221022201033023103222221213221 (Nob Hill)

This can then be converted to an S2 Cell ID of
6094788552675374000

When comparing to a nearby location of:
45.5308839,-122.6815796 >> 2/221022201033330012321301320023 (Pearl District)
S2 ID: 6094788657473797000

It's easy to see that I can do a scan on the HB Quatree Key on prefix 2/221022201033 and get both the Nob Hill and Pearl District returned and any other points that fall within that prefix.

What I don't understand is why taking a further step of converting the HB Quadtree Key to an S2Cell ID (which seems to be how many are people are implementing this geo-location technique) is necessary. It too can be scanned. In this case on the prefix 6094788. Does anyone know why this extra step is being taken and if it is necessary from an accuracy standpoint?

SeaFuzz
  • 1,177
  • 9
  • 28

1 Answers1

0

It looks like the s2 cell is a special variant of the hilbert curve, e.g. moore curve.

Moore curve is more accurate sometimes because start and end point is close to each other.

You can also treat the quadkey as a base-4 number but it doesn't add accurracy. However I think it's looks nicer.

Micromega
  • 12,486
  • 7
  • 35
  • 72