#🔒 GeoPandas: State Michigan being filled in inclusive of Lakes when performing US Heatmap

7 messages · Page 1 of 1 (latest)

lapis flower
#

Was following a tutorial here:
https://medium.com/@alex_44314/use-python-geopandas-to-make-a-us-map-with-alaska-and-hawaii-39a9f5c222c6

However, when I perform the same code, I get the attached pic with Lake Michigan and parts of Lake Superior/Lake Heron are also filled in. How do I ensure that only the landmasses are populated using geopandas? Tried looking at the documentation, but only complex examples are shown for nuanced use-cases.

Medium

Here’s one way to make a static choropleth map using geopandas and matplotlib.

pliant yachtBOT
#

@lapis flower

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

static trail
# lapis flower Was following a tutorial here: https://medium.com/@alex_44314/use-python-geopand...

unless you have some column in your dataset indicating whenever a given geometry is a landmass or not, geopandas has no means to know what each part of your data refers to

if you somehow do have such as column, filter to remove it before plotting
if you don't (most likely scenario), you would need to modify the geometry - either manually editing the dataset by hand in some cartography program or by using geometries from a different dataset instead

lapis flower
#

So, as far as I understood from this tutorial, I matched up a State column to the Shape file(s). If I'm using the wrong shapefile, I'm wondering if that's somehow the source of the issue here. I appreciate you taking the time to respond!

#

I'll look into that. I'm thinking that might the variable there I hadn't considered.

pliant yachtBOT
#
Python help channel closed for inactivity

This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.