Home > front end >  GeoPandas: Plot two Geo DataFrames over each other on a map
GeoPandas: Plot two Geo DataFrames over each other on a map

Time:04-16

I am new to using Geopandas and plotting maps from Geo Dataframe. I have two Geo DataFrames which belong to the same city. But they are sourced from different sources. One contains the Geometry data for houses and another for Census tracts. I want to plot the houses' boundary on top of the tract boundry.

Below is the first row from each data set. I am also not sure why the Geometry Polygon values are on such a different scale in each of these datasets.

  1. Houses Data Set House Data
  2. Tract Data Set Tract Data

I tried the following code in the Jupyer Notebook but nothing is showing up.

f, ax = plt.subplots()
tract_data.plot(ax=ax)
house_data.plot(ax=ax)

But an empty plot shows up.

This is my first post. Please let me know what else I can provide.

CodePudding user response:

You probably need to set the correct coordinate reference system (crs). More info here

An easy fix might be

f, ax = plt.subplots()
tract_data.to_crs(house_data.crs).plot(ax=ax)
house_data.plot(ax=ax)
  • Related