[Python] A random line over Greenland when reprojecting to lon=30

Discussão em 'Python' iniciado por Stack, Maio 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a map on Pyhton and someone recommended that I reporject it to lon=30 for better visuals. But when I do that a random line over Greenland appears. I can't seem to get rid of it.

    import matplotlib.patches as mpatches
    import matplotlib.pyplot as plt
    import seaborn as sns
    import geopandas as gpd
    import os
    import zipfile
    import pyproj

    # Define A1 paper size in inches
    a1_width_inches = 33.1
    a1_height_inches = 23.4

    # Specify the shapefile URL and filename
    shapefile_url = "https://naturalearth.s3.amazonaws.com/110m_cultural/ne_110m_admin_0_countries.zip"
    shapefile_zip = "ne_110m_admin_0_countries.zip"
    shapefile_name = "ne_110m_admin_0_countries.shp"

    # Download the shapefile if it doesn't exist
    if not os.path.exists(shapefile_name):
    # Download the zip file
    !wget {shapefile_url} -O {shapefile_zip}

    # Extract the shapefile
    with zipfile.ZipFile(shapefile_zip, 'r') as zip_ref:
    zip_ref.extractall()

    print(f"Shapefile downloaded and extracted to: {shapefile_name}")

    # Load the world map data directly from the downloaded file
    world = gpd.read_file(shapefile_name)

    # Define the Winkel Tripel projection
    winkel_tripel_crs = "+proj=wintri +lon_0=30 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"

    # Reproject the GeoDataFrame
    world = world.to_crs(winkel_tripel_crs)

    Continue reading...

Compartilhe esta Página