├── docs └── installing_cartopy_debian.md ├── .gitignore ├── LICENSE └── README.md /docs/installing_cartopy_debian.md: -------------------------------------------------------------------------------- 1 | Title: 2 | Date: 3 | Category: 4 | Modified: 5 | Tags: 6 | Slug: 7 | Authors: 8 | Summary: 9 | 10 | First install cython and numpy on cartopy 0.13 because failure. Then install libproj-dev e libgdal-dev e libgeos-dev. Depois 11 | 12 | export CPLUS_INCLUDE_PATH=/usr/include/gdal 13 | 14 | export C_INCLUDE_PATH=/usr/include/gdal 15 | 16 | 17 | e aí 18 | 19 | pip install gdal==1.10 20 | 21 | só então pode instalar pip install "cartopy[plotting]". 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## 2 | data 3 | lib 4 | 5 | # Byte-compiled / optimized / DLL files 6 | __pycache__/ 7 | *.py[cod] 8 | *$py.class 9 | 10 | # C extensions 11 | *.so 12 | 13 | # Distribution / packaging 14 | .Python 15 | env/ 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | *.egg-info/ 28 | .installed.cfg 29 | *.egg 30 | 31 | # PyInstaller 32 | # Usually these files are written by a python script from a template 33 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 34 | *.manifest 35 | *.spec 36 | 37 | # Installer logs 38 | pip-log.txt 39 | pip-delete-this-directory.txt 40 | 41 | # Unit test / coverage reports 42 | htmlcov/ 43 | .tox/ 44 | .coverage 45 | .coverage.* 46 | .cache 47 | nosetests.xml 48 | coverage.xml 49 | *,cover 50 | .hypothesis/ 51 | 52 | # Translations 53 | *.mo 54 | *.pot 55 | 56 | # Django stuff: 57 | *.log 58 | 59 | # Sphinx documentation 60 | docs/_build/ 61 | 62 | # PyBuilder 63 | target/ 64 | 65 | #Ipython Notebook 66 | .ipynb_checkpoints 67 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Ivan Marin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Maps in Python 2 | 3 | I'm investigating the possible solutions for mapping in Python. The requirements are: 4 | 5 | - Plot several different elements (points, markers, lines, polylines, polygons) 6 | - I need to plot maps with variable resolution (from scale from 1:10 to 1:100.000) 7 | - A tiles provider (OpenStreetMap or other) 8 | - The plots should be generated offline 9 | - A good interface with pandas 10 | - Map interaction with time variable 11 | 12 | Interesting discussion: 13 | 14 | - https://news.ycombinator.com/item?id=6604785 15 | - http://sensitivecities.com/so-youd-like-to-make-a-map-using-python-EN.html 16 | 17 | ## Folium 18 | [Folium](https://github.com/python-visualization/folium/) is a Python interface for the [Leaflet](https://github.com/Leaflet/Leaflet) Javascript map library. 19 | 20 | - Still an early project (version 0.1.6 or 0.2.0-dev) 21 | - The default tile provider is OpenStreetMap 22 | - There is no [offline](https://github.com/python-visualization/folium/issues/351) option for the moment (every redraw calls the tile API) 23 | - Supports markers, points, lines, polylines and floaters 24 | - Can scale, depending only on the tiles available 25 | - Has a nice gallery with jupyter notebooks as [examples](http://nbviewer.jupyter.org/github/ocefpaf/folium_notebooks/tree/master/) 26 | 27 | ## Plotly 28 | [Plotly](https://github.com/plotly/plotly.py) was a closed source, server-based general plotting library that has been open sourced recently. 29 | 30 | - A more mature project 31 | - Can do several kinds of visualizations 32 | - Is able to plot offline 33 | - Supports markers, points, lines 34 | - [Cannot scale](https://github.com/plotly/plotly.js/issues/249) the underlying tiles 35 | 36 | 37 | ## Basemap 38 | [Basemap](https://github.com/matplotlib/basemap/) is a [Matplotlib](https://github.com/matplotlib/) extension for mapping and cartography. 39 | 40 | - Is based on matplotlib, so again, if you are familiar with Matplotlib is quite easy to adapt 41 | - Is static, no interactivity 42 | - Kinda complicated to install (no pip package easily available) 43 | - Can scale and has high resolution maps 44 | - Very flexible with cartographic settings 45 | - Probably will not be maintained in the [long term](https://github.com/matplotlib/basemap/issues/191) (Cartopy is suggested as a possible replacement) 46 | 47 | ## Cartopy 48 | [Cartopy](https://github.com/SciTools/cartopy) is a static cartographic library based on Matplotlib. 49 | 50 | - Needs shapely < 1.5.12, otherwise fails 51 | - Static maps, no interaction 52 | - Can use several tile providers or no tiles at all 53 | - Can read shapefiles 54 | - Uses shapely 55 | - Matplotlib integration makes easier to use (if you know matplotlib, that is) 56 | - Supports markers, points, lines, polylines 57 | - Can cache the tiles and maps, plots are static by default 58 | 59 | ## But why not use ? 60 | Several plotting tools are using a Javascript backend to do the plotting, like Plotly and Folium. Why not use directly Javascript? So far, the main reason is that our stack is mostly Python and the platforms where the data is coming from is messy. Python is the glue that we use to hide the several backend data sources, so having Python is a reasonable choice for now. 61 | --------------------------------------------------------------------------------