I'm trying to plot a bunch of points on a city map and am having trouble finding a package that will work well. It looks like Matplotlib Basemap doesn't include enough detail for lots of points spanning a 30 mile radius e.g. I'm not seeing a way to add highways and other distinguishing features at a small scale.
I therefore ask if you can suggest how to add these types of city map features to Basemap or if there is another package that will work well for 30 mile scale scatter plots over a city map. Thanks for your help!
Basemap allows you to create map plots in python. It extends matplotlib's functionality by adding geographical projections and some datasets for plotting coast lines and political boundaries, among other things.
Basemap would work well, I think. Adding zip code boundaries and primary/secondary roads (and a lot of other data) is no problem if you can get the geographic shapefiles. Here is one example output:
If you're interested in mapping a place in the US, this site has free shapefiles: http://www.landsat.com/free-gis-data.html
I used Texas zip code and road data (and a bunch of lat/long coords) to generate the map above.
You would load the shapefiles like this:
self.map = Basemap(projection='merc', lat_0=mlat, lon_0=mlon, resolution = 'l', area_thresh = 1.0,
llcrnrlon=-num, llcrnrlat=num,
urcrnrlon=-num, urcrnrlat=num)
map.readshapefile('/home/person/zipfolder/rds/tl_2010_48_prisecroads', 'Streets',drawbounds = False)
for shape in self.map.Streets:
xx, yy, = zip(*shape)
self.map.plot(xx, yy, linewidth = 1.5, color='green', alpha=.75)
##Same for zip codes
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With