This page is a quick reference for you for the course, including quick reference guides for installing the understandinggis
Python environment using Anaconda, Setting up and using Git and GitHub, a set of Python snippets as an aide memoire for usage (to avoid you having to search through the practicals to find them), a consolidated list of the literature referred to in the course materials, and some general guidance on code presentation and forum usage.
If there is anything that you would like me to add to this page, just let me know!
Contents
- Instructions for Installing the Anaconda Environment
- Python Examples
- Git setup & Examples
- Reading List
- General Guidance
- Fixing the
Matplotlib is building the font cache
error for Spyder in the Computer Labs
Reading List
Reading is not required in this course (as I expect you to spend your time practicing coding!) - but here is an indicative reading list of text that I reference in the course for those who are interested:
Articles referenced in the lectures and practicals
- Battersby, S. E., Finn, M. P., Usery, E. L., & Yamamoto, K. H. (2014). Implications of web Mercator and its use in online mapping. Cartographica: The International Journal for Geographic Information and Geovisualization, 49(2), 85-101.
- Brent, R. P. (1973). An Algorithm with Guaranteed Convergence for Finding a Zero of a Function. In Algorithms for Minimization without Derivatives, Englewood Cliffs, NJ: Prentice-Hall,
- Bresenham, J. E. (1965). Algorithm for computer control of a digital plotter. IBM Systems journal, 4(1), 25-30.
- Canters, F., Deknopper, R., & De Genst, W. (2005). A new approach for designing orthophanic world maps. In Proceedings of the 22nd International Cartographic Conference (pp. 9-16).
- Crameri, F., Shephard, G. E., & Heron, P. J. (2020). The misuse of colour in science communication. Nature communications, 11(1), 1-10.
- Gosling P., C. & Symeonakis E. (2020). Automated map projection selection for GIS, Cartography and Geographic Information Science, 47:3, 261-276.
- Guttman, A. (1984). R-trees: A dynamic index structure for spatial searching. In Proceedings of the 1984 ACM SIGMOD international conference on Management of data (pp. 47-57).
- Hart, P. E.; Nilsson, N. J.; Raphael, B. (1968) A Formal Basis for the Heuristic Determination of Minimum Cost Paths. IEEE Transactions on Systems Science and Cybernetics SSC4 4 (2): 100-107.
- Huck, J., Whyatt, D., & Coulton, P. (2015). Visualizing patterns in spatially ambiguous point data. Journal of Spatial Information Science, 2015(10), 47-66.
- Huck, J. (2024). Evaluating Map Projections for Globemaking. The Cartographic Journal, 61(3), 207-217.
- Karney, C. F. (2013). Algorithms for geodesics. Journal of geodesy, 87(1), 43-55.
- Kaučič, B., & Zalik, B. (2002, April). Comparison of viewshed algorithms on regular spaced points. In Proceedings of the 18th spring conference on Computer graphics (pp. 177-183).
- Leutenegger, S. T., Lopez, M. A., & Edgington, J. (1997, April). STR: A simple and efficient algorithm for R-tree packing. In Proceedings 13th international conference on data engineering (pp. 497-506). IEEE.
- Mandelbrot, B. (1967). How long is the coast of Britain? Statistical self-similarity and fractional dimension. science, 156(3775), 636-638.
- Matsumoto, M., & Nishimura, T. (1998). Mersenne twister: a 623-dimensionally equidistributed uniform pseudo-random number generator. ACM Transactions on Modeling and Computer Simulation (TOMACS), 8(1), 3-30.
- Roth, R. E., Brewer, C. A., & Stryker, M. S. (2011). A typology of operators for maintaining legible map designs at multiple scales. Cartographic Perspectives, (68), 29-64.
- Schelling, T. C. (1969). Models of segregation. The American Economic Review, 59(2), 488-493.
- Schelling, T. C. (1971). Dynamic models of segregation. Journal of mathematical sociology, 1(2), 143-186.
- Šavrič, B., Jenny, B., & Jenny, H. (2016). Projection wizard–an online map projection selection tool. The Cartographic Journal, 53(2), 177-185.
- Usery, L. E., & Seong, J. C. (2001). All equal-area map projections are created equal, but some are more equal than others. Cartography and Geographic Information Science, 28(3), 183-194.
- Visvalingam M. & Whyatt J., D. (1993) Line generalisation by repeated elimination of points, The Cartographic Journal, 30:1, 46-51.
- Visvalingam, M. (2016). The Visvalingam Algorithm: Metrics, measures and heuristics. The Cartographic Journal, 53(3), 242-252.
- Wolfram, S. (1983). Statistical mechanics of cellular automata. Reviews of modern physics, 55(3), 601.
Relevant Books
- Canters, F. (2002). Small Scale Map Projection Design. CRC Press, Boca Raton.
- Chacon, S., & Straub, B. (2014). Pro git (2nd ed.). Springer Nature.
- Crooks, A. et al. (2019) Agent Based Modelling & Geographical Information Systems: A Practical Primer. Sage, London.
- Iliffe, J. & Lott, R. (2008). Datums and Map Projections for Remote Sensing, GIS and Surveying (2nd ed.). CRC Press, Boca Raton.
- Lawhead, J. (2013). Learning Geospatial Analysis with Python. Pakt, Birmingham, UK.
- Rowińska, P. (2024). Mapmatics: A Mathematician’s Guide to Navigating the World. Harvard University Press.
- Van Sickle, J. (2010) Basic GIS Coordinates (2nd ed.). CRC Press, Boca Raton.
- Westra, E. (2010). Python Geospatial Development. Pakt, Birmingham, UK.
- Duckham, M., Sun, Q. C., & Worboys, M. F. (2023). GIS: A computing perspective. CRC press.
- Xiao, N (2015) GIS Algorithms. Sage, New York.
Useful Websites
- Python Software Foundation (2025). Documentation for the Python Programming Language.
- Python Software Foundation (2013). PEP8: Style Guide for Python Code
- Roth et al. (2011) Generalisation Operators.
- Šavrič et al (2025) Projection Wizard
- Veness, C. (2025) Calculate distance, bearing and more between Latitude/Longitude points.
- Veness, C. (2025) Vincenty solutions of geodesics on the ellipsoid.
- W3Schools (2025). Python Tutorial.
- Weisstein, E. W. (2002). Elementary cellular automaton
General Guidance
Code Presentation
Presenting neat and tidy code is an important part of Python - one of the key ideas that Guido van Rossum had when creating Python was that code is read much more often than it is written, and so it makes sense to prioritise readability over writability.
Good, tidy, readable code demonstrates that It will demonstrate that you are a competent programmer, and will even help to get you good marks in your assessments! Key elements of well presented code include:
- Follow the Rule of Thirds and make sure that your comments explain exactly what is going on.
- Make sure that variable, function and class names are all descriprive of what they do.
- Use
snake_case
for variable and function names. - Use
CamelCase
for class names. - Don’t let lines get too long - use line breaks where appropriate!
To learn all about how best to present your code, check out PEP8, the official Style Guide for Python Code.
Forum Etiquette
One of the reasons that we use a forum is that it is vitally important that modern programmers can use a forum properly (both asking and answering questions). For this reason, the course staff will not answer emails about Python directly - only through the forum. Don’t worry about the efficiency of this, in practice the forum just sends us an email anyway, so responses will be just as quick!
Key elements of a good post include:
- Before posting, make sure that you have searched both the forum and the web for an answer - these days it is quite likely that your question has been asked many times before, and finding them will get you an answer more quickly. Most online forums will reject duplicate questions.
- Make sure that your title explains the issue clearly - this will help attract people to answer your question, as well as help others benefit from the answer (see point 1).
- Explain the problem and ask a question - if you just post some code stating that “this doesn’t work” you are highly unlikely to attract an answer. You need to demonstrate that you have put in the effort (see point 1) to encourage people to put in the effort to help you.
- Paste code as text, not a screenshot - people need to be able to copy and paste it to test it and solve the issue, and are highly unlikely to go to the trouble of typing it all out from an image! When you paste into the editor, set the formatting to Preformatted using the drop-down, and the font of your code snippet to somethig appropriate like
Courier New
. You can also make use of tools such as the highlighter to help illustrate your problem. - Similarly, you should also paste error messages in the same manner as code (see point 4) - someone helping you will likely want to search for information online, and will be unlikely to wish to type out the error message to do so.
- When including an error message, you should include the entire error message - not just an excerpt.
- Do not just attach your code in a zip file and hope that people will want to read it - you need to identify the sections where the error is and paste it as per point 4. Only attach your code if directly asked for it.
- Spelling, grammar and punctuation are important: remember to proof read before posting your question or answer.
- Be polite! People are much less likely to help you if you are rude.
You can learn more about how to write a good forum post in the official Stack Overflow guide here.
Fixing the matplotlib
Error in Spyder
On the first use of Spyder in the University Computer Labs, you might get a message in the console pane (bottom right) saying something like:
Matplotlib is building the font cache, this may take a minute
Give it 5 mins then click the
x
where it says Console 1/A.
All being well, the console will reload without the error. If this worked, you do not need to read any further.
However, some of you might find that this is not the case, and the error does not disappear. If this is the case for you, there is a simple fix:
Close Spyder, then in the start menu open Git → Git Bash (make sure you have loaded Git from Apps Anywhere first, otherwise it will not appear in the menu!).
A black command box should open.
Now, type the following command into the command box, replacing
mxxxxxxx
with your username, then press Enter (note if you want to copy and paste then you need to do Right Click → Paste, not Ctrl+V!):
rm -rf C:\\Users\\mxxxxxxx\\.matplotlib
This deletes a directory (folder) of data that is preventing the Python Interpreter from loading properly.
Now re-open Spyder, give Matplotlib 5 mins to actually build the font cache, then click the
x
where it says Console 2/A.
All being well, the console will now reload without the error! You should not need to do this again after the first usage.
Great!