Exercise 3#


Please complete this exercise by the end of day on Thursday, 23 November, 2023 (the day before next week’s work session).

To start this assignment, accept the GitHub classroom assignment, and clone your own repository, e.g., in a CSC Notebook instance. Make sure you commit and push all changes you make (you can revisit instructions on how to use git and the JupyterLab git-plugin on the website of the Geo-Python course.

To preview the exercise without logging in, you can find the open course copy of the course’s GitHub repository at github.com/Automating-GIS-processes-2022/Exercise-3. Don’t attempt to commit changes to that repository, but rather work with your personal GitHub classroom copy (see above).


Coordinate reference systems#


Remember the difference between defining a CRS, and re-projecting a layer into a new CRS! Before re-projecting, the layer should have a valid CRS definition which you can check like this: data.crs.

To define a projection, assign a new CRS to a geo-data frame’s crs property:

data.crs = pyproj.CRS("EPSG:4326")

This will update the metadata, only. The actual coordinate values will remained unmodified. Use this only if the original CRS definition is missing or invalid.

To re-project a geopandas.GeoDataFrame, use its to_crs() method:

data = data.to_crs("EPSG:4326")

This will actually transform the geometry features of the data frame, AND re-define the CRS definition stored in the .crs property.