Skip to content

Commit

Permalink
Merge pull request #14 from ONSgeo/Tyde_changes
Browse files Browse the repository at this point in the history
Tyde changes
  • Loading branch information
TydeONS authored Jul 9, 2024
2 parents 4e86d3a + c154138 commit 80e1eab
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions _docs/guides/python_install_anaconda.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ description: Step-by-step installation instructions for Python geospatial packag

## Before you start:


You will need to install **Anaconda** This is a Python distribution used for data science, [more information here](https://www.anaconda.com/download).
The goal of this guide is to create a Python virtual environment which will support geospatial work in Python. A virtual environment has two components: the Python interpreter that the virtual environment runs on, and a folder containing the libraries installed in the virtual environment. The main reason we use virtual environments is to isolate different Python projects because Python cannot simultaneously use multiple versions of the same package. The isolated environment also ensures that there are no complications with different tasks requiring different and conflicting dependencies.

Before you create the Python virtual environment, you will need to install **Anaconda**. This is a distribution of Python used for data science, [more information here]((https://www.anaconda.com/download).

If you are part of another government department and using a networked laptop, please approach your IT team for how to install Anaconda Suite.

Expand Down Expand Up @@ -50,7 +51,7 @@ If the steps until now have worked it will now say “(geopy38)” before the pr

*conda install pip*

This could also take a little while as it’s a large install. This would be a good time to make use of that coffee from earlier. ☕
This could also take a little while as it’s a large install. This would be a good time to make use of that coffee from earlier. ☕ PIP (Package Installer for Python) is used to install and manage packages that are not part of the [Python standard library](https://docs.python.org/3/py-modindex.html). You can use pip to install, upgrade, and uninstall packages.

![Setting up the new environment](img/geopy_install_05_pip.png)

Expand Down Expand Up @@ -88,7 +89,29 @@ Now we can install the packages. Type each of these in sequence, followed by ent

*python -m ipykernel install \--user \--name geopy38*





Why install these packages in particular?\
**numpy**: Useful for creating arrays (of XY coordinates or an elevation raster, for example) and manipulating numerical data inside them.\
**pandas**: Data manipulation package for tabular data (DataFrames). Import, export, clean, aggregate data with pandas.\
**ipython**: An interactive python shell. Acts as a kernel for Jupyter notebooks.\
**ipykernel**: Built on top of ipython. In Jupyter notebooks, you’re using ipykernel to execute code interactively.\
**rtree**: Provides spatial indexing features like nearest neighbour search, intersection, union, joins etc.\
**gdal**: Geospatial data abstraction library. GDAL provides useful command line utilities for data translation, processing, and conversion. QGIS and ArcGIS uses gdal as a backend library.\
**fiona**: Streams simple feature data to and from GIS formats like GeoPackage and Shapefile. Used in combination with Shapely.\
**pyproj**: Can project and transform coordinates across various geographic reference systems.\
**shapely**: Create and work with vector geometries.\
**geopandas**: Extension of pandas library but handles GeoDataFrames. These are DataFrames with a geometry column.\
**matplotlib**: Visualizations of geospatial data; scatterplots/heatmaps/choropleths maps etc.\
**mapclassify**: Handles classifying data e.g for choropleth maps by providing classification schemes. Use in conjunction with geo-visualisation packages like GeoPandas.\
**folium**: Data visualisation library for creating interactive maps.



Now you have your geopy38 virtual environment with all the packages above installed. To use the geopy38 environment as a Jupyter notebook kernel, type the following command:

*python -m ipykernel install --user --name geopy38*

## Testing the installation & further activities:

Expand Down

0 comments on commit 80e1eab

Please sign in to comment.