

So You'd Like to Make a Map using Python - urschrei
http://sensitivecities.com/so-youd-like-to-make-a-map-using-python-EN.html
Use Pandas, Matplotlib, and Basemap to extract, clean and re-arrange data, before creating a series of thematic maps.
======
Demiurge
Cool article, explains how you can do anything using Python, although doesn't
mention Mapnik. However, for most people, these days I would recommend to try
TileMill
([https://www.mapbox.com/tilemill/](https://www.mapbox.com/tilemill/)) to make
a map. The CartoCSS can let you style anything based on attributes and it also
lets you add and style raster data.

~~~
LeafStorm
Can you draw brightly colored lines on roads for a bus map? I like to mess
around analyzing bus routes, but so far I haven't been able to find a
computer-based tool for drawing them effectively.

~~~
maxerickson
Tilemill ingests geographic/spatial data, it doesn't have much provision for
interacting with it.

You might find that someone has already drawn the bus routes you are
interested in:

[http://wiki.openstreetmap.org/wiki/Buses](http://wiki.openstreetmap.org/wiki/Buses)

(Then you just have the task of pulling the data out of OSM and translating it
into a format that you can work with)

~~~
Demiurge
Also, I just realized, if the bus routes are not in the OSM, he could use the
new iD editor and add the bus routes to OSM under his account, and then export
:)

------
polskibus
My biggest problem with maps these days is the data license for commercial
use. I dont need very detailed map, usually administrative level 2, but it's
hard to find accurate sources that dont make you pay thousands of dollars per
small userbase. We create our own app and distribute it, therefore cannot
exactly estimate our userbase. Does anybody know of a decent source with good,
fairly detailed world maps and liberal license ? Doesn't have to be free.

~~~
maxerickson
Openstreetmap?

Just requires a simple attribution.

(there are certainly lots of things to work on in the data)

~~~
polskibus
The freely available dumps to SHP are not up -to-date or have insufficient
details and my several efforts to produce an SHP myself have failed. I'd like
to be able to produce a shp dump that contains only selected "layer" for given
country.

~~~
sivetic
I think OGR (gdal.org) has an OSM driver that you can install optionally to go
from OSM -> SHP. Problem is that SHP and OSM are not 100% compatible formats,
so data massaging may be necessary in many cases.

Also, Geofabrik.de will export it for you for a fee.

~~~
polskibus
I tried QGis 2 with built-in OSM support but I was unable to properly download
data through it. Perhaps I was doing something wrong, I'd love to read a good
tutorial on this. If you happen to find one, let me know!

~~~
sivetic
It's been a while since I played with OSM data. OGR 1.10.0 supports OSM, and
you can grab it from various sources (gdal.org or gisinternals.com/sdk/ if you
want latest windows binaries).

Converting OSM -> SHP should be relatively similar to other formats, and there
are a good number of tutorials out there for using OGR. Here's their page on
OSM:
[http://www.gdal.org/ogr/drv_osm.html](http://www.gdal.org/ogr/drv_osm.html)

------
pacofvf
In our company we use python to make maps, but we go with the traditional GIS
approach, dependencies?: postgis and mapnik. The first two examples would be
solved by a single postgis query, the last one maybe would require some extra
work. But nice work anyway, bookmarked.

------
jofer
Surprised to see that they're using basemap instead of cartopy. There's
nothing wrong with using basemap, but it can be a bit clunky, i.m.o.

Then again, cartopy is only a year or two old, so it doesn't have the traction
that basemap does. It's gained a fairly large following very quickly, though.

~~~
urschrei
Doing the same thing using Cartopy is next on my list!

------
gjreda
There's also Vincent[1], which has some mapping capabilities and is built on
top of Vega (a "visualization grammar" for d3js).

[1]:
[https://github.com/wrobstory/vincent](https://github.com/wrobstory/vincent)

~~~
urschrei
Yep, I'm very interested in exploring the (Geo)pandas / Vincent / Vega
intersection.

------
dannypgh
Cartography? Hasn't everything already sort of been discovered, though by,
like, Magellan and Cortés?

~~~
sp332
Cartography is about making _maps_ , not discoveries.

~~~
bennyg
Except for figuring out about Pangaea and continental drift.

~~~
jofer
That has nothing to do with cartography. That's geology.

Geology often uses cartography to display data and various spatial analysis
methods to analyze data, but what you're describing is purely geology.

Sorry if I sound snippy... But as a geologist, we get a bit annoyed when one
of the major discoveries of our field is attributed to "those darn
geographers"! :)

------
jaegerpicker
Very cool, article. I've always loved maps and mapping and python is my
preferred language. The only thing I would mention is that it would be nice to
have a pic of the results earlier in the article, that's just from the "let's
look at this article, seems cool but what exactly is he teaching me" angle.
I'm more likely to try the code if I can see the results up front. Otherwise
it was a really cool example.

------
spiritplumber
[http://www.robots-
everywhere.com/re_wiki/index.php?title=Geh...](http://www.robots-
everywhere.com/re_wiki/index.php?title=Gehandler) I wrote a sort of google
earth API wrapper thing in python if anyone wants it. Windows only though.

------
pagekicker
What are blue plaques?

~~~
acheron
Historical markers: "on this spot in 18xx something happened" kind of thing.

[https://en.wikipedia.org/wiki/Blue_plaque](https://en.wikipedia.org/wiki/Blue_plaque)

------
cwal37
Very interesting, it had never occurred to me that there were probably python
libraries for mapping. My ArcMap license expires in less than two weeks,
perhaps I will give this a shot before I re-up.

------
zmjones
This is exactly why I prefer R for static maps. Would have taken like a
quarter of the time, if that.

~~~
urschrei
A) The article's (quite clearly) not geared towards concision.

B) Personally, I'm delighted that there are various ways to do this. It's good
for innovation.

------
namelezz
Cool! I have been looking for an article like this. Thank you for sharing.

