I'm looking to get some data of this page


To do it I need to create the links in this format:


So at first I need to have a list with all the US cities sorted by state, where can I find that data? Preferably in .csv format or some other machine readable format (I am using Python).

  • Yes that sounds like the right format. I clicked on the link for Brisbane, CA: greatschools.org/california/brisbane/schools. Just don't use quotes. What are you looking for? Standardized test scores by school district or something else? Because Michigan puts aggregated test scores online for each district. (I used to work for a Michigan school.)
    – Bulrush
    Commented Jan 6, 2016 at 18:12
  • I Just need the distribution of school by zip code for a machine learning project. Commented Jan 6, 2016 at 20:52
  • Schools do not always follow zip code boundaries. 2 schools can share the same zip code boundaries. The zip code is mainly for use by the USPS. We have some really messed up school district boundaries here in Michigan that were developed long ago.
    – Bulrush
    Commented Jan 7, 2016 at 13:09
  • Many other resources from SO in 2010 stackoverflow.com/q/3845006/2327328
    – philshem
    Commented Feb 15, 2016 at 19:59

3 Answers 3


I have a CSV file you can download that lists all US cities by state. The data was compiled from the US Census 2013 Gazetteer.


In case you must have the data from that domain, each state's information is listed on the states index pagef, and follows similar naming conventions. For example, here's Virginia's index page:
All Cities in Virginia:
All School Districts in Virginia:

  • Could you say the accuracy level of this data- pleasee
    – Learner
    Commented Aug 25, 2016 at 13:52
  • I can no longer access opengeocode.org.
    – influent
    Commented May 25, 2021 at 15:47

The US Census Bureau also has a national gazeteer file with state and city info, including incorporation information.

For metadata/excel file column please have a look at HERE.

  • 2
    How much accurate is it. I see its precision is upto 6th decimal places and I checked some points that does not match with the google earth.There are (balance),borough,CDP,City,comunidad,corporation,county,County,government,municipality,Princeton,town,urbana,village in this file but some of them is on road/inside jungle?
    – Learner
    Commented Aug 26, 2016 at 5:01

You might try using data from the Geonames.org database. You can download gazateer data by country from this list.

Another potential source is the the MaxMind GeoLite2 dataset.

  • GeoLite2 database only contains names no geographic information like latitude and longitude.
    – Learner
    Commented Aug 26, 2016 at 4:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.