Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good python toolkit for plotting points on a city map? [closed]

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!

like image 519
user3654387 Avatar asked May 20 '14 05:05

user3654387


People also ask

What is basemap in python?

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.


1 Answers

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: enter image description here

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
like image 68
Ryan Avatar answered Sep 28 '22 03:09

Ryan