|
| 1 | +# Introduction |
| 2 | + |
| 3 | +A Geographic Information System (GIS) software is a software designed to import, analyze and visualize geographic data. |
| 4 | +PyGISS is a lightweight GIS software based on the standard Python library for GUI programming: tkinter. |
| 5 | +It allows users to create maps by importing shapefiles (.shp files), a format that describes maps as a set of polygons. |
| 6 | + |
| 7 | + |
| 8 | + |
| 9 | +# PyGISS dependencies |
| 10 | + |
| 11 | +PyGIS relies on three Python libraries: |
| 12 | + |
| 13 | +* pyshp, used for reading shapefiles. |
| 14 | +* shapely, used for converting a multipolygon into a set of polygons |
| 15 | +* pyproj, used for translating geographic coordinates (longitude and latitude) into projected coordinates |
| 16 | + |
| 17 | +Before using PyGISS, you must make sure all these libraries are properly installed: |
| 18 | + |
| 19 | +``` |
| 20 | +pip install pyshp |
| 21 | +pip install shapely |
| 22 | +pip install pyproj |
| 23 | +``` |
| 24 | + |
| 25 | +The extended PyGISS version also uses ImageTk from Pillow: |
| 26 | + |
| 27 | +``` |
| 28 | +sudo apt-get install python3-tk (unix) |
| 29 | +sudo apt-get install python3-pil.imagetk (unix) |
| 30 | +pip install pillow (windows & unix) |
| 31 | +``` |
| 32 | + |
| 33 | +# PyGISS versions |
| 34 | + |
| 35 | +## Standard version (pyGISS.py, < 100 lines) |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | +The standard version implements PyGISS in less than 100 lines of code. |
| 40 | + |
| 41 | +It contains: |
| 42 | +* a menu 'Import shapefile' for the user to choose a shapefile and draw the map. |
| 43 | +* a menu 'Switch projection' to switch between the mercator and azimuthal orthographic projection. |
| 44 | + |
| 45 | +The following bindings are implemented: |
| 46 | +* the right-click button allows the user to move the display in any direction |
| 47 | +* the scroll wheel can be used for zooming in and out. |
| 48 | +* pressing the left-click button on the map will print the associated geographical coordinates (longitude, latitude). |
| 49 | + |
| 50 | +A few shapefiles are available for testing in the 'PyGISS/shapefiles' folder (world countries, continents, France, US). |
| 51 | + |
| 52 | +## Extended version (extended_pyGISS.py, < 500 lines) |
| 53 | + |
| 54 | + |
| 55 | + |
| 56 | +The extended version shows how to use PyGISS to create a full-on GIS software. |
| 57 | +Besides the import of shapefiles, nodes can be created with a "Drag & Drop" system, moved on the map, and deleted. |
| 58 | +They can also be imported by creating an Excel file that contains the longitude and latitude of the nodes. (an example is available in the 'PyGISS/import' folder). |
| 59 | + |
| 60 | +To create a node, press the left-click button on the Python Software Foundation icon in the menu, and hold it down until you've reached the desired location on the canvas. |
| 61 | +Pressing the left-click button on the canvas allows the user to either select one or several nodes, or move all selected nodes. |
| 62 | +The right-click button and the scroll wheel work like in PyGISS standard version. |
| 63 | + |
| 64 | +The menu on the left allows the user to import a shapefile and draw the associated map ("Import map"), erase the map or a selection of nodes, and switch between the mercator and azimuthal orthographic projections. |
| 65 | + |
| 66 | +For each node on the canvas, the geographical coordinates (longitude and latitude) are displayed under the node, and the position is updated in real-time upon moving the node. |
| 67 | + |
| 68 | +## Golf version (golf_pyGISS.py, 5 lines) |
| 69 | + |
| 70 | + |
| 71 | + |
| 72 | +The golf version implements the core feature of PyGISS (import of shapefiles) in 5 lines of code. |
| 73 | +Upon running golf_GISS.py, a window pops up for the user to choose a shapefile. |
| 74 | +The shapefile is then imported and drawn on the canvas. |
| 75 | +The mouse wheel allows the user to move on the map by zooming in and zooming out. |
0 commit comments