Difference between revisions of "Creating Maps in Jupyter Notebook using GeoPandas"

From CUOSGwiki
Jump to navigationJump to search
Line 11: Line 11:
 
This tutorial will be for Windows machines. The following steps will assume that the user is on a Windows platform, and therefore if you are using any other machine, the steps may be slightly different. This tutorial will assume that you have anaconda installed. If not, install it [https://docs.anaconda.com/anaconda/install/ here]. You may also choose to simply install miniconda which will run everything necessary for the purpose of this tutorial, and most jupyter notebook commands. You can install miniconda [https://docs.anaconda.com/anaconda/install/silent-mode/ here] in silent mode (recommended).
 
This tutorial will be for Windows machines. The following steps will assume that the user is on a Windows platform, and therefore if you are using any other machine, the steps may be slightly different. This tutorial will assume that you have anaconda installed. If not, install it [https://docs.anaconda.com/anaconda/install/ here]. You may also choose to simply install miniconda which will run everything necessary for the purpose of this tutorial, and most jupyter notebook commands. You can install miniconda [https://docs.anaconda.com/anaconda/install/silent-mode/ here] in silent mode (recommended).
   
  +
To start, you will need to install geopandas. This can be done easiest through the Command Line in Windows. To open this up, you can search for “Command Prompt” in the Windows Start Menu, and right-click “Run as Administrator” on the Command Prompt application. Next, you should “Change Directory” using the cd prompt to where you would like geopandas to be installed. For the purpose of this tutorial, I will be installing it into a working folder, however I recommend installing geoPandas somewhere permanent in your file directory that will be easy to navigate to in the future.
  +
  +
Next, we will be creating a new environment for geopandas. This is optional, but also recommended as good practise, as you may have dependency conflicts from previous installs of other software on your machine. This way, we can have a fresh start. To do this, enter the following command:
  +
  +
''conda create -n [name of environment]''
   
 
===Step 2: Downloading data===
 
===Step 2: Downloading data===

Revision as of 10:01, 11 December 2020

Introduction

About Jupyter

Jupyter's advantages include that it is a free and open-source web application that also runs locally on your machine. This means that you can share and edit code easily with other people, but also have easy version controls saved to your machine. Another advantage of Jupyter is that you can type code into kernels, and run those kernels individually. This will be demonstrated in the tutorial, but as a quick explanation -- the benefits to this include being able to test code easily, be able to quickly visualize a certain data table or in our case, create a map quickly without having to run all of the code at once.

Tutorial

Step 1: Installing the software

This tutorial will be for Windows machines. The following steps will assume that the user is on a Windows platform, and therefore if you are using any other machine, the steps may be slightly different. This tutorial will assume that you have anaconda installed. If not, install it here. You may also choose to simply install miniconda which will run everything necessary for the purpose of this tutorial, and most jupyter notebook commands. You can install miniconda here in silent mode (recommended).

To start, you will need to install geopandas. This can be done easiest through the Command Line in Windows. To open this up, you can search for “Command Prompt” in the Windows Start Menu, and right-click “Run as Administrator” on the Command Prompt application. Next, you should “Change Directory” using the cd prompt to where you would like geopandas to be installed. For the purpose of this tutorial, I will be installing it into a working folder, however I recommend installing geoPandas somewhere permanent in your file directory that will be easy to navigate to in the future.

Next, we will be creating a new environment for geopandas. This is optional, but also recommended as good practise, as you may have dependency conflicts from previous installs of other software on your machine. This way, we can have a fresh start. To do this, enter the following command:

conda create -n [name of environment]

Step 2: Downloading data

Step 3: Introduction to Jupyter Notebook

Step 4: Editing the data

Step 5: Making a map in Jupyter Notebook

Step 6: Importing and editing the map in QGIS