Hex grid on 4326 globe (for use in leaflet)

المشرف العام

Administrator
طاقم الإدارة
Im looking for a way to evenly distribute a hexagon grid (x,y,z) on the 4326 globe. Knowing this is not mathematically possible im accepting the following limitations:

  • Poles doesnt need coverage - from lat -75 to lat 75 is sufficent.
  • International date line - 0/180 lng is OK to be messed up.
  • Distortion is OK as long as its not noticed by eye when viewing the grid at zoom ~100*100 hexes.
My hexagonal grids topology is defined according to this picture:


Some further conditions

  • The hexagons are ~50 meter height.
  • Im assuming hex(0,0,0) to be located at LatLng(0,0)
I need a function hexToLatLng(x,y,z) and a function LatLngToHex(lat,lng)How can these lookup functions be created in javascript?

Below are some of my attempts.

By using the estimates

  • M meter in north direction = M *(1/111111) degrees lat
  • M meter in east direction = M *(1/(111111*cos(lat)) degrees lng
I implemented hexToLatLng and LatLngToHex.However increasing errors seems to sum up and give big shifts in longitude accuracy when moving away from equator. I guess its because the estimates assuming a sphere and 4326 is ellips?

Because the hex system is planar I first tried 900913 and proj4js until I learned 900913 is not very suitable for distance calculations. I would also prefer sticking to 4326 as its easy to work with in my leaflet map. But any thoughts on this track also much welcome.

I did find this thread but im hoping theres other solutions given Im accepting the drawbacks at the poles?http://stackoverflow.com/questions/749264/covering-earth-with-hexagonal-map-tiles



أكثر...
 
أعلى