Designing a location based database

Source :https://www.youtube.com/watch?v=OcUKFIjhKu0

  • Use : pincode and zipcode to mark places

  • Scalability and Uniformity

  • Measurable Distance and Proximity

Storing it in Database

  • Longitude and Langitude

  • Use 64 Bit datatype ( 32 bit for the x axis and 32 bit for the Y axis )

For Seaching for Coordinates in 2D Plane (Difficult)

  • Quad tree Algo (similar to like binary tree but have two dimmensions )

For Seaching for Coordinates in 1D Plane (Easy)

  • Convert 2D Plane to 1D plane to solve it like a Interval tree or segment tree

  • Convert 2D to 1D using concept called fractals

  • Draw hilbert curve

Last updated

Was this helpful?