If you ever wanted to know the lengths of most US city longitudes & latitudes

4 points by cgrusden ↗ HN
Right before I ran a database migration to create the tables to house the lat & long information for US Cities I realized that longitude and latitude strings could never be over 100 characters long. Instead of blindly using 24 characters or even 20, I wanted to know what I was working with for US Cities ONLY.

The small gist below shows the very small range of length for the lat & longs.

https://gist.github.com/2698035

spoiler: It's between 9-11 for latitude, and 11-12 for longitude

3 comments

[ 4.7 ms ] story [ 26.2 ms ] thread
(comment deleted)
I recommend using six decimal places for best accuracy, so 34.100912, -121.187176
I concur, the data I'm using is coming from one of the free databases out there, so whatever the lengths are, i'll use for now.

Luckily ~90% of the geocoded records are 6+ decimal places

Thanks mapster