I am trying to plot a map of Spain using Geopandas and Matplotlib. I am using the GeoJSON file you see below in which the geometry is in geographical coordinates (EPSG 4326)
I would like to plot the map in Mercator projection but when I try to convert the units using
df.to_crs({'init': 'epsg:3395'})
I receive an error saying:
RuntimeError: b'no arguments in initialization list'
I have followed the instructions in http://geopandas.org/projections.html. There it says that if the geopandas dataframe does not count with the information of the CRS, you must define it. But this is not the problem here.
This is the code I have so far
import geopandas as gpd
%matplotlib inline
import matplotlib.pyplot as plt
geojson_url = 'https://raw.githubusercontent.com/codeforamerica/click_that_hood/master/public/data/spain-provinces.geojson'
df = gpd.read_file(geojson_url)
If I run the following command:
df.crs
I receive the following response (which means that the geopandas DataFrame have the information about CRS)
{'init': 'epsg:4326'}
Then
df = df.to_crs({'init': 'epsg:3395'})
Returns an error
What am I missing? Thanks in advance.