Skip to content

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

4 pointscgrusden2 comments
On 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

Comments

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

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.