I'm using django and basemap to render tiles i can use to make an
overlay on google maps. I'm using this to generate a topology of an open
mesh network (freifunk) here in leipzig
On my local developing machine this works very nice and due heavy
caching of database lookups it doesn't seem slow. My problem is, that
the production machine isn't that fast and has to little memory
Now I'm thinking of a better algorithm to generate the tiles. Currently
they are generated on demand and then saved to disc for later usage. But
the topology is fetched every 10 minutes, so the disc files timeout
my current algorithm looks like this:
fetch all node positions and cache them through pickle.
These are rendered as small blue dots on the map (Yes, here I can
optimize to only call plot when the node is in boundries of the tile.
then all connections for the last topo are fetched and cached.
Now there is a problem, I have to plot all connections into the plot,
because it's not easy to say which lines are actually in the tile. I
haven't looked deep into matplotlib to know how optimized it already
ignores plots which are out of bound.
Now I'm asking my self: is it possible to make a basemap instance with
some lat/lng borders, plot all stuff in it, and then move the borders to
get a new tile which is next to the last one ? Would such a algorithm be
faster then the current one ?
If not, there is also the posibility to create one large image at
largest zoomlevel for the most used region and then cut and scale the
image until all tiles are generated.
You can find the sourcecode at:
mktopo() is acutally doing the work