Haven’t dig into legal issues yet, but for my hobby project I got everything regarding map from here:
After getting shp files from the web site, I use pyshp module:
https://code.google.com/p/pyshp/
To extract data to plain text format so that other programs can read it directly. There is an old version of pyshp comes with Ubuntu, but it’s sufficient to me.