basemap - Plot on map projections (with coastlines and political boundaries) using matplotlib.

Overview

Basemap

Plot on map projections (with coastlines and political boundaries) using matplotlib.

⚠️ Warning: this package is being deprecated in favour of cartopy.

Requirements

  • Python 2.6 (or higher)

  • matplotlib

  • numpy

  • pyproj

  • pyshp

  • The GEOS (Geometry Engine - Open Source) library (version 3.1.1 or higher). Source code is included in the geos-3.3.3 directory.

  • On Linux, if your Python was installed via a package management system, make sure the corresponding python-dev package is also installed. Otherwise, you may not have the Python header (Python.h), which is required to build Python C extensions.

Optional

  • OWSLib (optional) It is needed for the BaseMap.wmsimage function.

  • Pillow (optional) It is needed for Basemap warpimage, bluemarble, shadedrelief, and etop methods. PIL should work on Python 2.x. Pillow is a maintained fork of PIL.

Copyright

Source code for the GEOS library is included in the geos-3.3.3 directory under the terms given in LICENSE_geos.

The land-sea mask, coastline, lake, river and political boundary data are extracted from datasets provided with the Generic Mapping Tools (GMT) and are included under the terms given in LICENSE_data.

Everything else (including src/_geos.c and src/_geos.pyx) is licensed under the terms given in LICENSE:

Copyright (C) 2011 Jeffrey Whitaker

Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notices appear in all copies and that both the copyright notices and this permission notice appear in supporting documentation.

THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Documentation

See http://matplotlib.github.com/basemap/

See scripts in examples directory for example usage.

Read the FAQ and/or email the matplotlib-users mailing list if you have problems or questions.

Install

  1. Install pre-requisite Python modules numpy and matplotlib.

  2. Then download basemap-X.Y.Z.tar.gz (approx 100 MB) from the GitHub Releases page, unpack and cd to basemap-X.Y.Z.

  3. Install the GEOS library. If you already have it on your system, just set the environment variable GEOS_DIR to point to the location of libgeos_c and geos_c.h (if libgeos_c is in /usr/local/lib and geos_c.h is in /usr/local/include, set GEOS_DIR to /usr/local). Then go to step (3). If you don't have it, you can build it from the source code included with basemap by following these steps:

     > cd geos-3.3.3
     > export GEOS_DIR=<where you want the libs and headers to go>
       A reasonable choice on a Unix-like system is /usr/local, or
       if you don't have permission to write there, your home directory.
     > ./configure --prefix=$GEOS_DIR
     > make; make install
    
  4. cd back to the top level basemap directory (basemap-X.Y.Z) and run the usual python setup.py install. Check your installation by running "from mpl_toolkits.basemap import Basemap" at the Python prompt.

  5. To test, cd to the examples directory and run python simpletest.py. To run all the examples (except those that have extra dependencies or require an internet connection), execute python run_all.py.

An alternative method is using pip:

pip install --user git+https://github.com/matplotlib/basemap.git

Contact

Ben Root [email protected]

Thanks

Special thanks to John Hunter, Andrew Straw, Eric Firing, Rob Hetland, Scott Sinclair, Ivan Lima, Erik Andersen, Michael Hearne, Jesper Larsen, Ryan May, David Huard, Mauro Cavalcanti, Jonas Bluethgen, Chris Murphy, Pierre Gerard-Marchant, Christoph Gohlke, Eric Bruning, Stephane Raynaud, Tom Loredo, Patrick Marsh, Phil Elson, and Henry Hammond for valuable contributions.

Comments
  • pip error on Macbook pro (m1 pro)

    pip error on Macbook pro (m1 pro)

    Hi! I am working on Macbook pro with basemap, but I met some issues. When I try to pip install basemap, there is something wrong with this. But I have already brew install geos, what's wrong? Thanks! image

    opened by CaffreyR 32
  • KeyError 'PROJ_LIB'

    KeyError 'PROJ_LIB'

    I install basemap with the command conda install basemap -c conda-forge

    but

    from mpl_toolkits.basemap import Basemap
    

    returns:

    ---------------------------------------------------------------------------
    KeyError                                  Traceback (most recent call last)
    <ipython-input-23-212c45f90d40> in <module>()
    ----> 1 from mpl_toolkits.basemap import Basemap
          2 #import matplotlib.pyplot as plt
          3 import numpy as np
    
    /srv/conda/lib/python3.6/site-packages/mpl_toolkits/basemap/__init__.py in <module>()
        144 
        145 # create dictionary that maps epsg codes to Basemap kwargs.
    --> 146 pyproj_datadir = os.environ['PROJ_LIB']
        147 epsgf = open(os.path.join(pyproj_datadir,'epsg'))
        148 epsg_dict={}
    
    /srv/conda/lib/python3.6/os.py in __getitem__(self, key)
        667         except KeyError:
        668             # raise KeyError with the original key value
    --> 669             raise KeyError(key) from None
        670         return self.decodevalue(value)
        671 
    
    KeyError: 'PROJ_LIB'
    
    opened by statiksof 32
  • wrapping of longitude

    wrapping of longitude

    I am trying to scatter plot on maps with nonzero middle longitude, but the areas where the map is "wrapped" are not plotted.

    My test script:


    from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt

    m = Basemap(lon_0=160) m.fillcontinents()

    for x in range(-179, 179):
    px1, py1 = m(x, x/4.0) m.scatter(px1,py1, zorder=3)

    plt.show()


    If lon_0 is zero it works fine but with non-zero lat_0 some areas are not plotted.

    It seems like the m(lon,lat) is not wrapping the points, the points I expect to wrap are negative in px1?

    Or am I missing some transformation step?

    opened by petrushy 32
  • Some possibility of installation

    Some possibility of installation

    Dear community, and possible people suffering as well,

    I also have struggles for installing basemap, especially with python3.6 (default shipped with Ubuntu 18.04) After several tries like using cartopy, using apt install to install cartopy and basemap. None of them works quickly for python3.6.

    In the end it works for this "simple" way:

    1. Installing pyproj (3.0.0) by python3 -m pip install pyproj==3.0
    2. installing matplotlib by python3 -m pip install matplotlib==3.3.3
    3. downloading the basemap 1.2.2 version and install also by python3 -m pip install . in the basemap untar folder.

    Hope this helps.

    opened by hydrogencl 30
  • Arcgisimage fails

    Arcgisimage fails

    I tried a simple map and add some arcgisimage, but it failed.

    Here is the code:

    m=Basemap(projection='cyl',llcrnrlon=-90,llcrnrlat=30,urcrnrlon=-60,urcrnrlat=60)
    m.arcgisimage(verbose=True)
    plt.show()
    

    And the error:

    Traceback (most recent call last):
      File "/home/bastien/PycharmProjects/untitled/rider_analysis.py", line 55, in <module>
        m.arcgisimage(verbose=True)
      File "/usr/lib/python3.5/site-packages/mpl_toolkits/basemap/__init__.py", line 4270, in arcgisimage
        return self.imshow(imread(urllib.request.urlopen(basemap_url)),origin='upper')
      File "/usr/lib/python3.5/site-packages/matplotlib/image.py", line 1326, in imread
        return handler(fname)
    SystemError: <built-in function read_png> returned NULL without setting an error
    
    Process finished with exit code 1
    

    After debugging around, I found that imread does not like http.request.HttpResponse, but works fine with file path.

    Regards,

    Bastien

    opened by bjacotg 19
  • Problem on installation 1.3.1 with sdist

    Problem on installation 1.3.1 with sdist

    Environment macOS Monterey Version 12.1 Chip Apple M1 Max Python 3.10.1

    With the goes library as below

    brew install geos
    export $GEOS_DIR=/opt/homebrew/Cellar/geos/3.10.2/
    /opt/homebrew/Cellar/geos/3.10.2/
    

    I tried to install basemap following the comments on #531

    poetry add basemap
    # same symptom with pip
    

    but installation failed with error

    EnvCommandError
    
      Command ['/Users/yuujin/Workspace/.venv/bin/pip', 'install', '--no-deps', 'file:///Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip'] errored with the following return code 1, and output: 
      Processing /Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip
        Preparing metadata (setup.py): started
        Preparing metadata (setup.py): finished with status 'error'
        ERROR: Command errored out with exit status 1:
         command: /Users/yuujin/Workspace/.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py'"'"'; __file__='"'"'/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-pip-egg-info-548b08zr
             cwd: /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/
        Complete output (9 lines):
        /private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py:52: RuntimeWarning: Cannot find GEOS library and/or headers in standard locations ('/opt/homebrew/Cellar/geos/3.10.2/'). Please install the corresponding packages using your software management system or set the environment variable GEOS_DIR to point to the location where GEOS is installed (for example, if 'geos_c.h' is in '/usr/local/include' and 'libgeos_c' is in '/usr/local/lib', then you need to set GEOS_DIR to '/usr/local'
          warnings.warn(" ".join([
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py", line 149, in <module>
            dev_requires = get_content("requirements-dev.txt", splitlines=True)
          File "/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/setup.py", line 23, in get_content
            with io.open(path, encoding="utf-8") as fd:
        FileNotFoundError: [Errno 2] No such file or directory: '/private/var/folders/5r/0p5dh9vx78qbptqmcm3zmgdm0000gn/T/pip-req-build-diy_eywu/requirements-dev.txt'
        ----------------------------------------
      WARNING: Discarding file:///Users/yuujin/Library/Caches/pypoetry/artifacts/b1/eb/1a/6b80b1e92c9b7b023c7d118d790f51ffc701b0c0e5f1e87b6959ab1b89/basemap-1.3.1.zip. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
      ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
    

    Even there exist header and built binary 'geos_c.h' and 'libgeos_c' in $GEOS_DIR

    opened by YuujinHwang 18
  • shiftdata exception when using latlon=True for scatter

    shiftdata exception when using latlon=True for scatter

    The exception;

    m.scatter(x, y,50,marker='o',color='g',latlon=True, zorder=10)
      File Anaconda\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 536, in with_transform
        x = self.shiftdata(x)
      File "Anaconda\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 4777, in shiftdata
        if itemindex:
    ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
    

    There seems to be a mismatch when using latlon that shiftdata does not expect. This can be mitigated by getting the projection coordinates before applying the operation; example below.

    from mpl_toolkits.basemap import Basemap
    import numpy as np
    import matplotlib.pyplot as plt
    
    def valueError():
        m = Basemap(projection='robin',lon_0=115,resolution='c')
        m.drawcoastlines()
        m.fillcontinents(color='sienna',lake_color='aqua')
        m.drawmapboundary(fill_color='lightsteelblue')
    
        x = [-5.435, -6.660817, -119.2511944, 17.719833]
        y = [36.136, 4.746717, 39.4030278, -14.657583]
        m.scatter(x, y,50,marker='o',color='g',latlon=True, zorder=10)
        plt.show()
    
    def works():
        m = Basemap(projection='robin',lon_0=115,resolution='c')
        m.drawcoastlines()
        m.fillcontinents(color='sienna',lake_color='aqua')
        m.drawmapboundary(fill_color='lightsteelblue')
        x = [-5.435, -6.660817, -119.2511944, 17.719833]
        y = [36.136, 4.746717, 39.4030278, -14.657583]
    
        x,y = m(x,y)
        m.scatter(x, y,50,marker='o',color='g',latlon=False, zorder=10)
        plt.show()
    
    def main():
        works()
        valueError()
    
    if __name__ == '__main__':
        main()
    
    opened by benranck 18
  • AttributeError: can't set attribute   ax._hold = self._tmp_hold

    AttributeError: can't set attribute ax._hold = self._tmp_hold

    Bug report

    Bug summary

    Basemap cannot work when I update the matplotlib to the new version 3.0.1.

    Code for reproduction

    import matplotlib.pyplot as plt
    import numpy as np
    from mpl_toolkits.basemap import Basemap
    
    outfile = r'E:\wrong.tif'
    
    # read in data on lat/lon grid.
    # data from https://github.com/matplotlib/basemap/tree/master/examples
    hgt = np.loadtxt(r'E:\tmp\basemap\500hgtdata.gz')
    lons = np.loadtxt(r'E:\tmp\basemap\500hgtlons.gz')
    lats = np.loadtxt(r'E:\tmp\basemap\500hgtlats.gz')
    lons, lats = np.meshgrid(lons, lats)
    
    mnh = Basemap(lon_0=-105, boundinglat=20.,
                  resolution='c', area_thresh=10000., projection='nplaea')
    xnh, ynh = mnh(lons, lats)
    CS = mnh.contour(xnh, ynh, hgt, 15, linewidths=0.5, colors='k')
    CS = mnh.contourf(xnh, ynh, hgt, 15, cmap=plt.cm.Spectral)
    
    mnh.drawcoastlines(linewidth=0.5)
    delat = 30.
    circles = np.arange(0., 90., delat).tolist() + \
              np.arange(-delat, -90, -delat).tolist()
    mnh.drawparallels(circles, labels=[1, 0, 0, 0])
    delon = 45.
    meridians = np.arange(0, 360, delon)
    mnh.drawmeridians(meridians, labels=[1, 0, 0, 1])
    plt.title('NH 500 hPa Height (cm.Spectral)')
    
    # colorbar on bottom.
    mnh.colorbar(pad='5%')
    plt.savefig(outfile, dpi=300, bbox_inches='tight')  
    plt.show()
    

    Actual outcome

    # If applicable, paste the console output here
    
    Traceback (most recent call last):
      File "E:/MyWork/code/python/psta/tmp.py", line 20, in <module>
        CS = mnh.contour(xnh, ynh, hgt, 15, linewidths=0.5, colors='k')
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 542, in with_transform
        return plotfunc(self,x,y,data,*args,**kwargs)
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3566, in contour
        self._restore_hold(ax)
      File "D:\Python36\lib\site-packages\mpl_toolkits\basemap\__init__.py", line 3229, in _restore_hold
        ax._hold = self._tmp_hold
    AttributeError: can't set attribute
    

    Expected outcome

    Matplotlib version

    • Operating system: Windows 10 x64
    • Matplotlib version: 3.0.1
    • Matplotlib backend (print(matplotlib.get_backend())): module://backend_interagg
    • Python version: 3.6.6
    • Jupyter version (if applicable): None
    • basemap version: 1.2.0
    • PyCharm version: 2018.2.4

    I install matplotlib and basemap from https://www.lfd.uci.edu/~gohlke/pythonlibs.

    opened by jiaozhh 17
  • Travis-CI:  Use  APT to install GEOS

    Travis-CI: Use APT to install GEOS

    Install libgeos using apt would probably save almost 4 minutes of build time. There is also a newer version of GEOS already packaged.

    In .travis.yaml replace the compiling of libgeos with this:

    addons:
      apt:
        packages:
        - libgeos-3.3.8
    

    Here are the docs for APT on Travis.

    I'm putting this here until I can get PR #234 working and merged.

    opened by micahcochran 17
  • geos projection cannot cross pole

    geos projection cannot cross pole

    Defining a Basemap in geostationary projection,

    >>> from mpl_toolkits.basemap import Basemap
    >>> Basemap(projection='geos', lon_0=0)
    

    fails in basemap-1.1.0 with the following error:

    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "...lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1109, in __init__
    self._readboundarydata('gshhs',as_polygons=True)
      File "...lib/python2.7/site-packages/mpl_toolkits/basemap/__init__.py", line 1241, in _readboundarydata
    raise ValueError('%s projection cannot cross pole'%(self.projection))
    ValueError: geos projection cannot cross pole
    
    opened by sfinkens 16
  • Use APT for libgeos on Travis

    Use APT for libgeos on Travis

    This is for issue #235 . Using the APT binary versions of libgeos speed up Travis test times by eliminating some of the compiling. Also, dashes were added to install steps to show the install timea for dependent packages.

    In testing, the overall Travis test time is about the same. It adds two additional tests builds.

    The way this is setup APT installs these period. setup.py does not have a way to force local libgeos install, which is probably not a bad thing.

    opened by micahcochran 15
  • Add CodeQL workflow for GitHub code scanning

    Add CodeQL workflow for GitHub code scanning

    Hi matplotlib/basemap!

    This is a one-off automatically generated pull request from LGTM.com :robot:. You might have heard that we’ve integrated LGTM’s underlying CodeQL analysis engine natively into GitHub. The result is GitHub code scanning!

    With LGTM fully integrated into code scanning, we are focused on improving CodeQL within the native GitHub code scanning experience. In order to take advantage of current and future improvements to our analysis capabilities, we suggest you enable code scanning on your repository. Please take a look at our blog post for more information.

    This pull request enables code scanning by adding an auto-generated codeql.yml workflow file for GitHub Actions to your repository — take a look! Whilst we've attempted to make use of the existing configuration that you had on LGTM.com, there may be some differences in environment used to build the project. We hope that in most cases it will not require significant changes to achieve a successful analysis. Check this page for detailed documentation on how to configure a CodeQL workflow.

    Questions? Check out the FAQ below!

    FAQ

    Click here to expand the FAQ section

    How often will the code scanning analysis run?

    By default, code scanning will trigger a scan with the CodeQL engine on the following events:

    • On every pull request — to flag up potential security problems for you to investigate before merging a PR.
    • On every push to your default branch and other protected branches — this keeps the analysis results on your repository’s Security tab up to date.
    • Once a week at a fixed time — to make sure you benefit from the latest updated security analysis even when no code was committed or PRs were opened.

    What will this cost?

    Nothing! The CodeQL engine will run inside GitHub Actions, making use of your unlimited free compute minutes for public repositories.

    What types of problems does CodeQL find?

    The CodeQL engine that powers GitHub code scanning is the exact same engine that powers LGTM.com. The exact set of rules has been tweaked slightly, but you should see almost exactly the same types of alerts as you were used to on LGTM.com: we’ve enabled the security-and-quality query suite for you.

    How do I upgrade my CodeQL engine?

    No need! New versions of the CodeQL analysis are constantly deployed on GitHub.com; your repository will automatically benefit from the most recently released version.

    The analysis doesn’t seem to be working

    If you get an error in GitHub Actions that indicates that CodeQL wasn’t able to analyze your code, please follow the instructions here to debug the analysis.

    How do I disable LGTM.com?

    If you have LGTM’s automatic pull request analysis enabled, then you can follow these steps to disable the LGTM pull request analysis. You don’t actually need to remove your repository from LGTM.com; it will automatically be removed in the next few months as part of the deprecation of LGTM.com (more info here).

    Which source code hosting platforms does code scanning support?

    GitHub code scanning is deeply integrated within GitHub itself. If you’d like to scan source code that is hosted elsewhere, we suggest that you create a mirror of that code on GitHub.

    How do I know this PR is legitimate?

    This PR is filed by the official LGTM.com GitHub App, in line with the deprecation timeline that was announced on the official GitHub Blog. The proposed GitHub Action workflow uses the official open source GitHub CodeQL Action. If you have any other questions or concerns, please join the discussion here in the official GitHub community!

    I have another question / how do I get in touch?

    Please join the discussion here to ask further questions and send us suggestions!

    opened by lgtm-com[bot] 0
  • [Doc]: (More) Clearly mark Basemap as deprecated

    [Doc]: (More) Clearly mark Basemap as deprecated

    Documentation Link

    No response

    Problem

    Basemap is deprecated and all users should be using Cartopy.

    In 2020, https://github.com/matplotlib/matplotlib/pull/16495 removed references to Basemap from matplotlib's documentation. Is it now time to more clearly mark Basemap as deprecated on https://matplotlib.org/basemap/ ?

    I do see that the deprecation is described at the bottom of https://matplotlib.org/basemap/ but:

    1. this statement can be missed (I recently met a user that had missed the information);
    2. the statement is only on the main Basemap doc page, not in pages linked from there (random example https://matplotlib.org/basemap/users/mapsetup.html).

    Suggested improvement

    Place bold/red warning statements on all pages of the Basemap documentation, starting from https://matplotlib.org/basemap/

    opened by TomLav 5
  • Filling ocean with Natural Earth shapefile does not produce the right result

    Filling ocean with Natural Earth shapefile does not produce the right result

    As per https://stackoverflow.com/questions/74433797/fill-oceans-in-high-resolution-to-hide-low-resolution-contours-in-basemap I'm trying to fill the ocean with high resolution polygons to mask out some low resolution filled contours. Unfortunately the built-in land sea mask of basemap is not enough for zoomed in regions.

    For this reason I'm trying to fill the ocean shapefiles of natural earth https://www.naturalearthdata.com/downloads/10m-physical-vectors/ using the following code

    m = Basemap(projection='merc',
                    llcrnrlat=36,
                    urcrnrlat=47,
                    llcrnrlon=6,
                    urcrnrlon=19,
                    lat_ts=20,
                    resolution='h')
    
    shp = m.readshapefile('../input/shapefiles/ne_10m_ocean/ne_10m_ocean',
                    'ne_10m_ocean', drawbounds = True)
    patches   = []
    for info, shape in zip(m.ne_10m_ocean_info, m.ne_10m_ocean):
        patches.append( Polygon(np.array(shape), True) )
            
    plt.gca().add_collection(PatchCollection(patches, facecolor= 'red', edgecolor='k', linewidths=1., zorder=2))
    

    This, however, does also fill some of the major islands with the same color of the ocean, as the following figure shows.

    Screen Shot 2022-11-14 at 17 06 08

    Am I doing something wrong? I checked the original shapefile and the polygons seem to be well defined. Here is the same plot done with Cartopy

    f557a896-d051-4e2e-a89c-3e40d0e9d679

    opened by guidocioni 0
  • Some countries borders not showing up in map

    Some countries borders not showing up in map

    I remember seeing this already a long time ago but I never managed to solve it.

    I'm plotting a map using this

    m = Basemap(projection='merc',
                    llcrnrlat=extents[2],
                    urcrnrlat=extents[3],
                    llcrnrlon=extents[0],
                    urcrnrlon=extents[1],
                    lat_ts=20,
                    resolution='h')
    
    m.fillcontinents(color='lightgray', lake_color='#2081C3', zorder=1)
    m.drawlsmask(land_color=(0, 0, 0, 0), ocean_color='#2081C3',
                     resolution='f', lakes=True, zorder=2, grid=1.25)
    
    ax = plt.gca()
    
    m.drawcountries(linewidth=0.8)
    m.drawcoastlines()
    
    m.readshapefile(f'{SHAPEFILES_DIR}/ITA_adm_shp/ITA_adm1',
                            'ITA_adm1', linewidth=0.8, color='black', zorder=5)
    
    

    but some countries (like Switzerland) don't show up.

    realtime_wind_italia

    Weirdly enough when centering the projection over France Switzerland shows up

    realtime_wind_francia

    opened by guidocioni 4
  • Enable flake8

    Enable flake8

    In the context of fixing current issues within basemap, one easy step is to use static analysis tools, since they can catch the most evident problems.

    I open this issue as a reminder to enable flake8 in the development workflow; flake8 will catch the most evident code mistakes, and it will also give advice on changes that will make the code more pep8-compliant. Enabling pylint at this moment is not recommended, because it will complain too much.

    opened by molinav 2
Releases(v1.3.6)
  • v1.3.6(Oct 31, 2022)

    This is a patch release that fixes the following issues:

    • Add support for Python 3.11.
    • Set MSVC 14.0 (VS2015) to build the GEOS library bundled in the precompiled Windows wheels.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.5(Oct 25, 2022)

    This is a patch release that fixes the following issues:

    • Fix broken array slicing inside addcyclic (thanks to @fragkoul).
    • Fix GeosLibrary wrapper to also work with GEOS >= 3.7.0 on Windows and GNU/Linux.
    • Fix wrong Antarctica coastline boundary with GEOS >= 3.9.0.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.4(Aug 11, 2022)

    This is a patch release that fixes the following issues:

    • Fix broken implementation of Basemap.arcgisimage.
    • Fix numpy requirement to ensure that builds also work on MacOS (thanks to @SongJaeIn for testing).
    • Enforce newer numpy and pillow versions when possible due to several vulnerabilities.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.3(May 12, 2022)

    This is a patch release that fixes the following issues:

    • Fix issue in drawcoastlines with shape of vertices array (thanks to @guziy).
    • Fix setup to identify GEOS dylib on MacOS correctly (thanks to @ronaldbradford and @CaffreyR for testing).
    • Remove dependency on six.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.2(Feb 10, 2022)

    This is a patch release that fixes the following issues:

    • Fix unusable source distribution file due to missing MANIFEST file (thanks to @DWesl).
    • Enforce newer numpy and pillow versions when possible due to several vulnerabilities.
    • Remove the deprecation notices.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.1(Jan 22, 2022)

    This is a patch release that fixes the following issues:

    • Provide support for Python 3.10 on Windows and GNU/Linux (x86 and x64).
    • Provide precompiled binary wheels for Python 3.10 on Windows and GNU/Linux (x86 and x64).
    • Improve the error message shown when requesting high- or full-resolution datasets and basemap-data-hires is not installed.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.3.0(Dec 29, 2021)

    This release focuses on the packaging of the library. In summary:

    • The library is split in three parts: basemap, basemap-data and basemap-data-hires.
    • Precompiled wheels for the three packages are available in PyPI.
    • Licensing is updated and clarified. The base license is MIT, with other components whose license is LGPL-2.1-only or LGPL-3.0-or-later.
    • Main branch is moved to the name develop, while master is kept for creating releases. Please submit future PR to the develop branch.

    Please visit the CHANGELOG for a complete list of changes.

    Source code(tar.gz)
    Source code(zip)
  • v1.2.2rel(Aug 6, 2020)

    This is quite likely the last release ever of basemap. Please move development efforts over to Cartopy!

    This release fixes some incompatibilities with matplotlib v3.3+ and also newer versions of libgeos (tested against v1.6.1). Also fixes some incompatibilities with the make.py.

    Source code(tar.gz)
    Source code(zip)
  • v1.1.0(May 4, 2017)

Owner
Matplotlib Developers
Matplotlib Developers
Python implementation of the Density Line Chart by Moritz & Fisher.

PyDLC - Density Line Charts with Python Python implementation of the Density Line Chart (Moritz & Fisher, 2018) to visualize large collections of time

Charles L. Bérubé 10 Jan 06, 2023
Color maps for POV-Ray v3.7 from the Plasma, Inferno, Magma and Viridis color maps in Python's Matplotlib

POV-Ray-color-maps Color maps for POV-Ray v3.7 from the Plasma, Inferno, Magma and Viridis color maps in Python's Matplotlib. The include file Color_M

Tor Olav Kristensen 1 Apr 05, 2022
Visualise Ansible execution time across playbooks, tasks, and hosts.

ansible-trace Visualise where time is spent in your Ansible playbooks: what tasks, and what hosts, so you can find where to optimise and decrease play

Mark Hansen 81 Dec 15, 2022
Area-weighted venn-diagrams for Python/matplotlib

Venn diagram plotting routines for Python/Matplotlib Routines for plotting area-weighted two- and three-circle venn diagrams. Installation The simples

Konstantin Tretyakov 400 Dec 31, 2022
A Python package that provides evaluation and visualization tools for the DexYCB dataset

DexYCB Toolkit DexYCB Toolkit is a Python package that provides evaluation and visualization tools for the DexYCB dataset. The dataset and results wer

NVIDIA Research Projects 107 Dec 26, 2022
Here I plotted data for the average test scores across schools and class sizes across school districts.

HW_02 Here I plotted data for the average test scores across schools and class sizes across school districts. Average Test Score by Race This graph re

7 Oct 27, 2021
https://there.oughta.be/a/macro-keyboard

inkkeys Details and instructions can be found on https://there.oughta.be/a/macro-keyboard In contrast to most of my other projects, I decided to put t

Sebastian Staacks 209 Dec 21, 2022
A package for plotting maps in R with ggplot2

Attention! Google has recently changed its API requirements, and ggmap users are now required to register with Google. From a user’s perspective, ther

David Kahle 719 Jan 04, 2023
The windML framework provides an easy-to-use access to wind data sources within the Python world, building upon numpy, scipy, sklearn, and matplotlib. Renewable Wind Energy, Forecasting, Prediction

windml Build status : The importance of wind in smart grids with a large number of renewable energy resources is increasing. With the growing infrastr

Computational Intelligence Group 125 Dec 24, 2022
An easy to use burndown chart generator for GitHub Project Boards.

Burndown Chart for GitHub Projects An easy to use burndown chart generator for GitHub Project Boards. Table of Contents Features Installation Assumpti

Joseph Hale 15 Dec 28, 2022
A Python library created to assist programmers with complex mathematical functions

libmaths was created not only as a learning experience for me, but as a way to make mathematical models in seconds for Python users using mat

Simple 73 Oct 02, 2022
Drug design and development team HackBio internship is a virtual bioinformatics program that introduces students and professional to advanced practical bioinformatics and its applications globally.

-Nyokong. Drug design and development team HackBio internship is a virtual bioinformatics program that introduces students and professional to advance

4 Aug 04, 2022
Python package for hypergraph analysis and visualization.

The HyperNetX library provides classes and methods for the analysis and visualization of complex network data. HyperNetX uses data structures designed to represent set systems containing nested data

Pacific Northwest National Laboratory 304 Dec 27, 2022
demir.ai Dataset Operations

demir.ai Dataset Operations With this application, you can have the empty values (nan/null) deleted or filled before giving your dataset to machine le

Ahmet Furkan DEMIR 8 Nov 01, 2022
Investment and risk technologies maintained by Fortitudo Technologies.

Fortitudo Technologies Open Source This package allows you to freely explore open-source implementations of some of our fundamental technologies under

Fortitudo Technologies 11 Dec 14, 2022
Splore - a simple graphical interface for scrolling through and exploring data sets of molecules

Scroll through and exPLORE molecule sets The splore framework aims to offer a si

3 Jun 18, 2022
Data Visualizer Web-Application

Viz-It Data Visualizer Web-Application If I ask you where most of the data wrangler looses their time ? It is Data Overview and EDA. Presenting "Viz-I

Sagnik Roy 17 Nov 20, 2022
This is a Cross-Platform Plot Manager for Chia Plotting that is simple, easy-to-use, and reliable.

Swar's Chia Plot Manager A plot manager for Chia plotting: https://www.chia.net/ Development Version: v0.0.1 This is a cross-platform Chia Plot Manage

Swar Patel 1.3k Dec 13, 2022
Massively parallel self-organizing maps: accelerate training on multicore CPUs, GPUs, and clusters

Somoclu Somoclu is a massively parallel implementation of self-organizing maps. It exploits multicore CPUs, it is able to rely on MPI for distributing

Peter Wittek 239 Nov 10, 2022
Visualizations of linear algebra algorithms for people who want a deep understanding

Visualising algorithms on symmetric matrices Examples QR algorithm and LR algorithm Here, we have a GIF animation of an interactive visualisation of t

ogogmad 3 May 05, 2022