1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Issue with Mismatching GSHHS and Natural Earth Shapefiles

Discussão em 'Python' iniciado por Stack, Setembro 15, 2024.

  1. Stack

    Stack Membro Participativo

    I am trying to plot data for the region of American Samoa but I am having issues with the coastlines. I generally use the higher resolution data from the Global Self-consistent, Hierarchical, High-resolution Geography Database but the coastline appears shifted from the data I am plotting and from other datasets such as NaturalEarth and Google maps.

    Does anyone know the source of this offset? Is this an issue with how I am plotting the coastlines, a map projection issue that I haven't taken into consideration, an issue with the GSHHS dataset, or maybe an issue with its implementation into Cartopy?

    Below is an example code illustrating my issue with the island of American Samoa shifted to the west in GSHHS (blue).

    import matplotlib.pyplot as plt
    import cartopy

    proj = cartopy.crs.PlateCarree()
    fig, ax = plt.subplots(subplot_kw=dict(projection=proj), figsize=(12,12))


    ax.add_feature(cartopy.feature.GSHHSFeature(scale='f'), facecolor="blue")

    ax.add_feature(cartopy.feature.NaturalEarthFeature("physical", "land", "10m"),
    ec="red", fc="yellow", lw=2, alpha=0.4)

    lon_min_ = -170.9
    lon_max_ = -170.55
    lat_min_ = -14.4
    lat_max_ = -14.2

    ax.set_extent([lon_min_, lon_max_, lat_min_, lat_max_],crs=proj)

    ax.gridlines(draw_labels=True,alpha=.4,linewidth=2, color='black', linestyle='--')

    plt.show()


    [​IMG]

    Continue reading...

Compartilhe esta Página