# Convert LLA (long, lat, alt) to flat earth model

I would like to divide the globe into 1000 $\times$ 1000 meter geodesic squares, and then map any long / lat to the applicable square.

The altitude of each block would be the altitude of the earth at the block's center.

Could someone point me in the right direction please as to how to calculate the flat grid and map long/lat to it.

EDIT

Since squares don't map onto a sphere, a solution I thought of is to calculate the circumference for a given latitude (taking into account the 1000 m grid), and divide it into 1000 m blocks (rounded up). So the number of blocks that map around the earth will decrease as we move away from the equator.

The squares will be slightly narrower at the top as we go North, and at the bottom as we go South.

-
What do you want to do about the fact that circles of latitude get shorter as you go towards the poles? The circumference of the earth is 40,000 km at the equator, so you would have 40 squares there. At 45 degrees latitude, it is only 28,000 km, so you would only have 28. One choice is to have more squares at the equator (dividing the central latitude circle by 1000 km, rounding, and letting the north and south boundaries be a different length). Or use ranges of longitude and letting the squares change size. Or en.wikipedia.org/wiki/Geodesic_grid, which gives up on squares. – Ross Millikan Aug 23 '12 at 12:53
I want the geodesic squares to remain the same size regardless of position. – IamIC Aug 23 '12 at 13:50
I understand that squares don't fit onto a sphere. They would have to scale slightly to fit as they go away from the equator. – IamIC Aug 23 '12 at 13:55

## 1 Answer

The length of a line of latitude is $4.0075E8 \cos \lambda$ meters, where $\lambda$ is the latitude. Similarly it is $4.0008E8$ meters around a line of longitude due to flattening. So your spacing in latitude is $\frac {360}{40075}$ degrees all the way around. Then at each latitude (it doesn't change much in 1 km) you have a spacing of $\frac {360}{40075 \cos \lambda}$ degrees to get 1 km by 1 km squares.

-
Thanks Ross. I had managed to work it out shortly before you answered. Sometimes one has to look from another angle, no pun intended. Added floor to get the vertical row height. – IamIC Aug 23 '12 at 17:26