Research Article
Location Privacy Protection Scheme for LBS in IoT
Algorithm 1
Geohash code generation algorithm.
Input: Position coordinates , code length | Output: Geohash code (CGh) | 1. , ; | 2. ; //The separate code length of longitude and latitude | 3. ; | 4. int , ; // is the number of latitudinal dichotomies, and is the number of longitude dichotomies | 5. , ; //Dichotomizing the latitude and the longitude | 6. while (latmid) //Convert longitude coordinates to binary | 7. { | 8. char ; | 9. if | 10. ; | 11. else ; | 12. ; | 13. } | 14. while (lonmid) //Convert latitude coordinates to binary | 15. { | 16. char ; | 17. if | 18. ; | 19. else ; | 20. ; | 21. } | 22. while //The longitude and latitude are combined, and the even bit is used to put the longitude, and the odd bit is used to put the latitude | 23. { | 24. int ; | 25. char ; | 26. if | 27. { | 28. ; | 29. ; | 30. ; | 31. } | 32. else | 33. { | 34. ; | 35. ; | 36. ; | 37. } | 38. return ; | 39. } | 40. int ; | 41. for (; ) | 42. { | 43. ; //Divide into groups of five digits | 44. ; //Map binary to Base32 | 45. ; | 46. ; | 47. } | 48. return CGh; //Get Geohash code |
|