World Cities Latitude/Longitude Database | Resources

We're happy to release an open source database of world cities along with their population, country, iso code, province, latitude and longitude.

Source: Natural Earth Populated Places 2015. Cleaned and formatted by Simplemaps.com.

License: MIT (attribution appreciated)

What's included?
Over 7,300 cities from around the world. Includes all country/province capitals, major cities and towns, and smaller towns in sparsely inhabited regions.

Format: SQL, CSV, Excel

Structure:

Download CSV (UTF-8) Download Excel Download SQL


JavaScript Function to Get the Distance Between Two Locations (Source)

function getDistanceFromLatLonInKm(lat1,lon1,lat2,lon2) {
  var R = 6371; // RadiWorld of the earth in km
  var dLat = deg2rad(lat2-lat1);  // deg2rad below
  var dLon = deg2rad(lon2-lon1); 
  var a = 
    Math.sin(dLat/2) * Math.sin(dLat/2) +
    Math.cos(deg2rad(lat1)) * Math.cos(deg2rad(lat2)) * 
    Math.sin(dLon/2) * Math.sin(dLon/2); 
  var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 
  var d = R * c; // Distance in km
  return d;
}

function deg2rad(deg) {
  return deg * (Math.PI/180)
}

© Simplemaps.com 2010-2017 | Home | License | Privacy Policy | Releases | Testimonials | Resources | Documentation
Formerly FlashUSAmap.com and Flashworldmap.com