Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I divide the globe in to small grids such that it allows me to assign each lat/long location to a grid? [closed]

In order to calculate the nearest locations that are represented by latitude/longitude, I was considering dividing the map into small grids, approximately 100x100 meter grids. Essentially each point would be assigned to a grid.

I understand that I could instead also use spatial indexes with MySQL etc, but am planning to use a non-relational database like Cassandra where it would be difficult to do indexing on spatial objects, and so some kind of grid approximation technique could be neat.

What would be the best way of creating such a grid system and mapping the 2-D spatial locations to it?

Edit1: It might be alright if the grids are not perfectly uniform, more so around the poles.

like image 673
Nishith Avatar asked Dec 01 '09 08:12

Nishith


People also ask

How is a grid used to locate places on a globe and on a map?

Lines of latitude and longitude form a global grid system. Any point on earth can be located by specifying its latitude and longitude, including Washington, DC, which is pictured here. Lines of latitude and longitude form an imaginary global grid system, shown in Fig.

How a grid helps us to find the position of a place?

Expert-verified answer A 'grid' is a network of lines on the globe. These lines are latitudes and longitudes. The latitudes run east-west on the globe, while the longitudes connect the North Pole and the South Pole. The grid helps to determine the accurate location of a place on the earth.

How is the grid system of lines of latitude and longitude used on a globe?

A system of lines is used to find the location of any place on the surface of the Earth. Commonly called a grid system, it is made up of two sets of lines that cross each other. One set—lines of latitude—runs in an east-west direction. The other set—lines of longitude—runs in a north-south direction.


1 Answers

Mapping from the two-dimensional spatial coordinates to your spatial index / geohash is an interesting problem. You might look at this article on quadtrees, geohashes and Hilbert curves. The Hilbert curve is a space-filling curve that provides locality; for your purposes, that means that nearby items in the one-dimensional spatial index will be nearby in two-dimensional space.

The goal (as described by other responders) is to minimize the number of queries necessary to cover the space in question without requesting tons of unnecessary data from the server. How you do the mapping from 2-d space to a 1-d index will affect that goal.

like image 143
npdoty Avatar answered Oct 21 '22 14:10

npdoty