python toolbox for visualizing geographical data and making maps

Overview

geoplotlib is a python toolbox for visualizing geographical data and making maps

data = read_csv('data/bus.csv')
geoplotlib.dot(data)
geoplotlib.show()

This will launch the geoplotlib window and plot the points on OpenStreetMap tiles, also allowing zooming and panning. geoplotlib automatically handles the data loading, the map projection, downloading the map tiles and the graphics rendering with OpenGL.

Examples source code is here

Installation

geoplotlib requires:

  • numpy
  • pyglet 1.2.4
    • note: in order for pyglet to work with ipython on Mac, version 1.2.4 or newer is needed

optional requirements:

to install from source run:

python setup.py install

or with pip:

pip install geoplotlib

User Guide

A detailed user guide can be found in the wiki

Comments
  • Cannot import name get_cmap on some examples

    Cannot import name get_cmap on some examples

    Stacktrace, Is there something that's missing to run this sample, I am facing this issue on

    1. delaunay.py
    2. graph-flights.py
    3. choropleth.py
    4. kde.py
    5. voronoi-filled.py
    2015-09-30 12:05:38.429 Python[19294:2380557] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/sx/5cqr_xwj5c50nlc6by1431sm0000gn/T/org.python.python.savedState
    Traceback (most recent call last):
      File "delaunay.py", line 10, in <module>
        geoplotlib.delaunay(data, cmap='hot_r')
      File "build/bdist.macosx-10.10-x86_64/egg/geoplotlib/__init__.py", line 177, in delaunay
      File "build/bdist.macosx-10.10-x86_64/egg/geoplotlib/layers.py", line 405, in __init__
      File "build/bdist.macosx-10.10-x86_64/egg/geoplotlib/colors.py", line 18, in __init__
    ImportError: cannot import name get_cmap
    
    opened by sudheesh001 9
  • Saving into a file, other than screenshot

    Saving into a file, other than screenshot

    Is it possible to save the maps into a file automatically from the python code, instead of using the keyboard control "P" to save a screenshot?

    opened by sabinej 7
  • Debian install crashes

    Debian install crashes

    In [1]: import geoplotlib 
    libGL error: pci id for fd 10: 80ee:beef, driver (null)
    OpenGL Warning: glFlushVertexArrayRangeNV not found in mesa table
    OpenGL Warning: glVertexArrayRangeNV not found in mesa table
    OpenGL Warning: glCombinerInputNV not found in mesa table
    OpenGL Warning: glCombinerOutputNV not found in mesa table
    OpenGL Warning: glCombinerParameterfNV not found in mesa table
    OpenGL Warning: glCombinerParameterfvNV not found in mesa table
    OpenGL Warning: glCombinerParameteriNV not found in mesa table
    OpenGL Warning: glCombinerParameterivNV not found in mesa table
    OpenGL Warning: glFinalCombinerInputNV not found in mesa table
    OpenGL Warning: glGetCombinerInputParameterfvNV not found in mesa table
    OpenGL Warning: glGetCombinerInputParameterivNV not found in mesa table
    OpenGL Warning: glGetCombinerOutputParameterfvNV not found in mesa table
    OpenGL Warning: glGetCombinerOutputParameterivNV not found in mesa table
    OpenGL Warning: glGetFinalCombinerInputParameterfvNV not found in mesa table
    OpenGL Warning: glGetFinalCombinerInputParameterivNV not found in mesa table
    OpenGL Warning: glDeleteFencesNV not found in mesa table
    OpenGL Warning: glFinishFenceNV not found in mesa table
    OpenGL Warning: glGenFencesNV not found in mesa table
    OpenGL Warning: glGetFenceivNV not found in mesa table
    OpenGL Warning: glIsFenceNV not found in mesa table
    OpenGL Warning: glSetFenceNV not found in mesa table
    OpenGL Warning: glTestFenceNV not found in mesa table
    libGL error: core dri or dri2 extension not found
    libGL error: failed to load driver: vboxvideo
    Segmentation fault
    
    opened by nagordon 7
  • Python 3 changes

    Python 3 changes

    Since there are no automated tests I cannot verify all the examples but the problem about inline maps not displaying should be fixed. It seems like tiles first appear black though, a reload usually helps to show the map tiles. Python version is 3.7.0

    opened by kkaiser 5
  • Negative values for maps

    Negative values for maps

    I'd like to show percentage changes of a quantity for different states on a map. However, in color.py, it generates an exception for negative values. When looking at colormap examples for matplotlib at http://matplotlib.org/examples/color/colormaps_reference.html it seems that the "diverging" colormaps are made for positive and negative values. Is there a deep reason for this exception, or could I comment it out and re-install geoplotlib like that? Thanks!

    opened by sabinej 5
  • way to store the output as a image

    way to store the output as a image

    I know I can use the keyboard key 'P' to take a screenshot, but I want to save the output using python only, since once we execute it runs in GUI in background but there's no way to save the result.

    opened by akanshajainn 3
  • adding optional attribute for coloring in graphlayer

    adding optional attribute for coloring in graphlayer

    Issue #26 .

    about the color option in graphlayer, like using edge weight or something else for coloring.

    I take you advice and finally figure out how it works and add a optional para for using other attribute.

    moreover, I have added the test data and example. But I am using python 3.5 and could testing myself. maybe you could like to run the example - graph_movement,py

    Though, I still tested the changes and It should work well.

    other stuff

    in graphlayer, the segmentation (old - distances) was like segmentations = np.logspace(0, log10(vmax),20)`

    maybe need be more optional, like logarithm, it could provide other base number, like 3,4,5.. for testing and better result, especially for some complected data.

    At last

    The graphlayer was amazing comparing with folium or other Libs, especially for big complex network, it works really well.

    opened by RiptideBo 3
  • problem importing geoplotlib under Windows 7

    problem importing geoplotlib under Windows 7

    I am running Windows 7 Enterprise (Service Pack 1). I run Python 2.7. I can run the pyglet "hello world" but when I import geoplotlib, I get the following error message:

    Traceback (most recent call last): File "<pyshell#1>", line 1 import geoplotlib File "C:\Python27\Lib\site-packages\geoplotlib__init__.py", line 24 global_config = AppConfig() File "C:\Python27\Lib\site-packages\geoplotlib__init_.py", line 9, in init self.reset() File "C:\Python27\Lib\site-packages\geoplotlib__init__.py", line 19, in reset screen = pyglet.canvas.get_display().get_default_screen() AttributeError: 'module' object has no attribute 'canvas'

    I did import pyglet before importing geoplotlib, and it does not make any difference. I also re-installed geoplotlib from the source, as you advised, but it still gives the same message.

    Pyglet was already installed with the Python version I downloaded a while ago (Python 2.7 from Enthought)

    Many thanks!!

    opened by sabinej 3
  • [geoplotlib.graph] about edge color.

    [geoplotlib.graph] about edge color.

    First of all, really thank geoplotlib . It helps me a lot.

    I recently use geoplotlib.graph to create graph on map, I notice that the color of edges represents the length of edges(I find it in the paper)。

    I wonder if there are any chance to draw the edge color based on edge weights or something else ?

    opened by RiptideBo 2
  • Adds encoding support to ShapeFileLayers

    Adds encoding support to ShapeFileLayers

    pyshp Reader allow us to set what type of encoding should be used when reading a shape file. Geoplotlib wrapper does not contain this parameters which are very useful. This PR adds this features to the wrapper and uses the same default values from pyshp when they are not provided by the users.

    • See: https://github.com/GeospatialPython/pyshp/blob/master/shapefile.py
    opened by tallysmartins 1
  • Coordinates: Order Matters - Longitude then Latitude (updated title)

    Coordinates: Order Matters - Longitude then Latitude (updated title)

    Hello All,

    I only have 2 years of experience with Python and only a few weeks of playing around with Geoplotlib. So, I'm no expert.

    I'm receiving a few exceptions when feeding a script-generated dictionary ultimately into the geoplotlib.plot() function. Utilizing the exact script sequence, but with a hand-written dictionary, ultimately a map is generated. After a good deal of experimentation, the crucial difference between the two dictionaries appears to be that one character space between the colon after the 'key' and the start of a list containing 'values' is present in the script-generated dictionary.

    ex: hand-written - {'key':[value]} script-generated dictionary - {'key': [value]} #note one character space between ':' and '['

    Here's a list of what appears to be the necessary modules loaded in my Python v3.6 installation:

    ... numpy 1.14.3 pandas 0.22.0 geoplotlib 0.3.2 matplotlib 3.0.2 pyglet 1.3.2 scipy 1.1.0 pyshp 1.2.12

    And an example of the script that runs fine in one case, ie produces a map, as well as the variation that produces the exceptions and no map. Note: Both dictionaries take the name 'dict' after their declaration statements below when ran separately through the rest of the script. Here, implying their renaming was done just to reduce redundancy in the post.

    < ... import numpy as np import pandas as pd import geoplotlib import matplotlib from geoplotlib.utils import DataAccessObject import pyglet import scipy

    ... generated_dict = {'lat': [37.7749, 51.5074], 'lon': [-122.4194, 0.1278]} # generated via extraction from a source static_dict = {'lat':[37.7749, 51.5074], 'lon':[-122.4194, 0.1278]} # typed by hand

    print(type(dict)) #output: <class 'dict'> print(type(dict['lat'][0])) #output: <class 'float'>

    df = pd.DataFrame(dict) # characteristics as expected

    dao = DataAccessObject(df) # no exceptions

    geoplotlib.dot(dao) # no exceptions

    geoplotlib.show() # static_dict results in producing map as expected. No exceptions # generated_dict throws exception at his step. No map generated

    Lastly, the exceptions produced:

    Console: Exceptions

    C:...Python\Python36\lib\site-packages\geoplotlib\core.py:753: RuntimeWarning: invalid value encountered in log ytile = (1.0 - np.log(np.tan(lat_rad) + (1 / np.cos(lat_rad))) / math.pi) / 2.0 * n

    File "C:...Python\Python36\lib\site-packages\geoplotlib\core.py", line 365, in start force_zoom=self.geoplotlib_config.requested_zoom)

    File "C:...Python\Python36\lib\site-packages\geoplotlib\core.py", line 677, in fit west_tile, north_tile = self.deg2num(bbox.north, bbox.west, self.zoom)

    File "C:...Python\Python36\lib\site-packages\geoplotlib\core.py", line 689, in deg2num ytile = (1.0 - math.log(math.tan(lat_rad) + (1 / math.cos(lat_rad))) / math.pi) / 2.0 * n ValueError: math domain error

    Any help would be greatly appreciated, how do I avoid generating exceptions when feeding a generated dictionary from my scripts into the rest of the processing steps leading to a map being generated? Thanks.

    opened by JimLakis 1
  • error: metadata-generation-failed

    error: metadata-generation-failed

    Python Version = 3.10.8 Facing issue while trying to install geoplotlib using pip install geoplotlib Install LOG:

    _Collecting geoplotlib Using cached geoplotlib-0.3.2.tar.gz (22 kB) Preparing metadata (setup.py) ... error error: subprocess-exited-with-error

    × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [1 lines of output] error in geoplotlib setup command: use_2to3 is invalid. [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed

    × Encountered error while generating package metadata. ╰─> See above for output._

    opened by C-h-i-rag 1
  • Queue module not supported in Python3

    Queue module not supported in Python3

    The Queue module used in geoplotlib/core.py is not supported in Python3. It has been changed to lowercase 'q' in python3.

    https://github.com/andrea-cuttone/geoplotlib/blob/83c39d94cdd8118ed1b65c0ef199463fc6bad346/geoplotlib/core.py#L4

    opened by Raghuram-Veeramallu 0
  • remove use_2to3

    remove use_2to3

    This package already supports python3. Removing the use_2to3 reference will allow this package to be installed via pip after the use_2to3 feature was removed in setuptools 58

    https://setuptools.readthedocs.io/en/latest/history.html#v58-0-0

    opened by rokrokss 1
  • Proposing a PR to fix a few small typos

    Proposing a PR to fix a few small typos

    Issue Type

    [x] Bug (Typo)

    Steps to Replicate and Expected Behaviour

    • Examine geoplotlib/init.py, geoplotlib/layers.py and observe segamentation, however expect to see segmentation.
    • Examine geoplotlib/init.py, geoplotlib/layers.py and observe tesselation, however expect to see tessellation.
    • Examine geoplotlib/init.py, geoplotlib/layers.py and observe sacle, however expect to see scale.
    • Examine geoplotlib/init.py and observe screeshot, however expect to see screenshot.

    Notes

    Semi-automated issue generated by https://github.com/timgates42/meticulous/blob/master/docs/NOTE.md

    To avoid wasting CI processing resources a branch with the fix has been prepared but a pull request has not yet been created. A pull request fixing the issue can be prepared from the link below, feel free to create it or request @timgates42 create the PR. Alternatively if the fix is undesired please close the issue with a small comment about the reasoning.

    https://github.com/timgates42/geoplotlib/pull/new/bugfix_typos

    Thanks.

    opened by timgates42 0
  • core.UiManager.Colorbar cannot map from minimal value to maximal value

    core.UiManager.Colorbar cannot map from minimal value to maximal value

    I am using geoplot to visualize air pressure at 10 m level. Air pressure values are always between 870 and 1084 hPa I am happy to feed the data as actual_data - minimum_value. I am not happy with the color bar which consequently reaches from 0 to 214 hPa and will have labels accordingly. I tried to overlay the colorbar class of UiManager, but did not have succes yet. Please see my proposed changes Proposedcolorbar.pdf

    opened by PietvdD 0
Owner
Andrea Cuttone
Andrea Cuttone
Example of animated maps in matplotlib + geopandas using entire time series of congressional district maps from UCLA archive. rendered, interactive version below

Example of animated maps in matplotlib + geopandas using entire time series of congressional district maps from UCLA archive. rendered, interactive version below

Apoorva Lal 5 May 18, 2022
Python Data. Leaflet.js Maps.

folium Python Data, Leaflet.js Maps folium builds on the data wrangling strengths of the Python ecosystem and the mapping strengths of the Leaflet.js

null 6k Jan 2, 2023
prettymaps - A minimal Python library to draw customized maps from OpenStreetMap data.

A small set of Python functions to draw pretty maps from OpenStreetMap data. Based on osmnx, matplotlib and shapely libraries.

Marcelo de Oliveira Rosa Prates 9k Jan 8, 2023
A toolbox for processing earth observation data with Python.

eo-box eobox is a Python package with a small collection of tools for working with Remote Sensing / Earth Observation data. Package Overview So far, t

null 13 Jan 6, 2022
Spatial Interpolation Toolbox is a Python-based GUI that is able to interpolate spatial data in vector format.

Spatial Interpolation Toolbox This is the home to Spatial Interpolation Toolbox, a graphical user interface (GUI) for interpolating geographic vector

Michael Ward 2 Nov 1, 2021
Location field and widget for Django. It supports Google Maps, OpenStreetMap and Mapbox

django-location-field Let users pick locations using a map widget and store its latitude and longitude. Stable version: django-location-field==2.1.0 D

Caio Ariede 481 Dec 29, 2022
Deal with Bing Maps Tiles and Pixels / WGS 84 coordinates conversions, and generate grid Shapefiles

PyBingTiles This is a small toolkit in order to deal with Bing Tiles, used i.e. by Facebook for their Data for Good datasets. Install Clone this repos

Shoichi 1 Dec 8, 2021
Python library to visualize circular plasmid maps

Plasmidviewer Plasmidviewer is a Python library to visualize plasmid maps from GenBank. This library provides only the function to visualize circular

Mori Hideto 9 Dec 4, 2022
Google maps for Jupyter notebooks

gmaps gmaps is a plugin for including interactive Google maps in the IPython Notebook. Let's plot a heatmap of taxi pickups in San Francisco: import g

Pascal Bugnion 747 Dec 19, 2022
Solving the Traveling Salesman Problem using Self-Organizing Maps

Solving the Traveling Salesman Problem using Self-Organizing Maps This repository contains an implementation of a Self Organizing Map that can be used

Diego Vicente 3.1k Dec 31, 2022
Interactive Maps with Geopandas

Create Interactive maps ??️ with your geodataframe Geopatra extends geopandas for interactive mapping and attempts to wrap the goodness of amazing map

sangarshanan 46 Aug 16, 2022
Google Maps keeps old satellite imagery around for a while – this tool collects what's available for a user-specified region in the form of a GIF.

google-maps-at-88-mph The folks maintaining Google Maps regularly update the satellite imagery it serves its users, but outdated versions of the image

Noah Doersing 111 Sep 27, 2022
Daily social mapping project in November 2021. Maps made using PyGMT whenever possible.

Daily social mapping project in November 2021. Maps made using PyGMT whenever possible.

Wei Ji 20 Nov 24, 2022
Implemented a Google Maps prototype that provides the shortest route in terms of distance

Implemented a Google Maps prototype that provides the shortest route in terms of distance, the fastest route, the route with the fewest turns, and a scenic route that avoids roads when provided a source and destination. The algorithms used were DFS, BFS, A*, and Iterative Depth First Search.

null 1 Dec 26, 2021
Spectral decomposition for characterizing long-range interaction profiles in Hi-C maps

Inspectral Spectral decomposition for characterizing long-range interaction prof

Nezar Abdennur 6 Dec 13, 2022
ArcGIS Python Toolbox for WhiteboxTools

WhiteboxTools-ArcGIS ArcGIS Python Toolbox for WhiteboxTools. This repository is related to the ArcGIS Python Toolbox for WhiteboxTools, which is an A

Qiusheng Wu 190 Dec 30, 2022
Using Global fishing watch's data to build a machine learning model that can identify illegal fishing and poaching activities through satellite and geo-location data.

Using Global fishing watch's data to build a machine learning model that can identify illegal fishing and poaching activities through satellite and geo-location data.

Ayush Mishra 3 May 6, 2022
Open Data Cube analyses continental scale Earth Observation data through time

Open Data Cube Core Overview The Open Data Cube Core provides an integrated gridded data analysis environment for decades of analysis ready earth obse

Open Data Cube 410 Dec 13, 2022
A public data repository for datasets created from TransLink GTFS data.

TransLink Spatial Data What: TransLink is the statutory public transit authority for the Metro Vancouver region. This GitHub repository is a collectio

Henry Tang 3 Jan 14, 2022