
A Coordinate Reference System (CRS) is a framework used to precisely locate geographic features on the Earth’s surface. It defines how the two-dimensional, projected map in your GIS relates to real places on the Earth.
The total number of defined CRS is vast, exceeding several thousand. This includes both geographic coordinate systems (based on a three-dimensional spherical surface) and projected coordinate systems (providing a flat, two-dimensional view of part of the spherical surface). This diversity allows for precise and appropriate representations of the Earth’s surface for various purposes and regions.
Given the large number of available CRS, it’s important to know how to work with them effectively in your geospatial analysis. In this tutorial, we will begin to explore how to handle CRS using GeoPandas.
Setting Up Our Environment
First, let’s import the necessary libraries and load our dataset:
import geopandas as gpd
import geodatasets
import matplotlib.pyplot as plt
# Load the world land dataset
world = gpd.read_file(geodatasets.get_path('naturalearth.land'))
Note: The current version of GeoPandas works best with matplotlib version 3.5.0 or higher.
How to Check the CRS of a GeoDataFrame
In GeoPandas, you can check the CRS of a GeoDataFrame using the crs attribute:
# Check the current CRS
print("Original CRS:")
print(world.crs)
This will output:
Original CRS: EPSG:4326
EPSG:4326 refers to the WGS84 geographic coordinate system, which is commonly used for global or continental scale data. It uses latitude and longitude to define locations on the Earth’s surface.
How to Transform Geospatial Data from One CRS to Another
GeoPandas provides the to_crs() method to transform data from one CRS to another. Here’s a general syntax:
new_gdf = original_gdf.to_crs('new_crs_code')
Where ‘new_crs_code’ can be an EPSG code, a proj4 string, or other CRS definitions recognized by GeoPandas.
Visualizing Data in Different CRS
Let’s visualize our world land data in its original CRS and then in some common projections:
1. WGS 84 (EPSG:4326)
# Plot the original data
world.plot(figsize=(8, 5))
plt.title("World Land (Original CRS - EPSG:4326)")
plt.show()

This map uses the equirectangular projection, which is a simple geographic projection that maps meridians to vertical straight lines of constant spacing, and parallels to horizontal straight lines of constant spacing.
2. Mercator Projection (EPSG:3395)
world_mercator = world.to_crs('EPSG:3395')
ax = world_mercator.plot(figsize=(8, 5))
ax.set_ylim(-18000000, 18000000) # Limit latitude range
plt.title("World Land (Mercator - EPSG:3395)")
plt.show()

When working with the Mercator projection, it’s important to be aware of its characteristics:
- The Mercator projection (EPSG:3395) causes extreme distortion at the poles.
- We need to set reasonable bounds for the plot to get a typical Mercator world map appearance.
- Land masses near the poles (like Greenland) appear much larger than they actually are.
- Despite its limitations, the Mercator projection remains useful for navigation due to its ability to preserve angles.
3. Robinson Projection (ESRI:54030)
world_robinson = world.to_crs('ESRI:54030')
world_robinson.plot(figsize=(8, 5))
plt.title("World Land (Robinson Projection - ESRI:54030)")
plt.show()

The Robinson projection provides a visually appealing balance by representing the entire globe with less distortion of area and shape compared to many other projections.
Key points about this projection:
- It strikes a compromise between the distortions of area, direction, and shape.
- Landmasses near the poles appear more proportional compared to the Mercator projection.
- It’s widely used for general-purpose world maps where a visually appealing and relatively accurate representation is desired.
- It’s not suitable for navigation as it doesn’t preserve angles.
When and Why to Change CRS
There are a few factors worth considering when you are juggling between different CRS options:
- Appropriate visualization: As we’ve seen with our world map examples, different projections can significantly affect how your data looks on a map. The choice of projection can dramatically alter the apparent size and shape of continents and oceans.
- Accurate measurements: Different projections can affect calculations of distance, area, and other spatial measurements. For accurate area calculations, it’s often necessary to use an equal-area projection, which preserves the relative sizes of land masses.
- Data integration: When working with multiple datasets, they need to be in the same CRS to be accurately overlaid and analyzed together. The ability to transform data between different CRS is useful when combining data from various sources.
- Specific analysis requirements: Some types of spatial analysis require data to be in a specific CRS. For example, certain distance calculations might require a projected coordinate system rather than a geographic coordinate system.
When working with geospatial data, it’s important to always be aware of the CRS of your datasets and choose projections that are appropriate for your specific visualization or analysis needs.
Conclusion
Working with Coordinate Reference Systems is a fundamental skill in geospatial analysis. GeoPandas provides powerful tools to check, set, and transform CRS, making it easier to work with geospatial data from various sources and for different purposes.
Remember, while there are thousands of defined CRS, understanding the basics and knowing how to work with a few common ones will cover most of your geospatial analysis needs. As you become more experienced, you’ll develop an intuition for which CRS to use in different situations.
