Skip to content

yan-sln/Sine-Saloum-infrastructures-map-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sine Saloum Map Project

This project generates a visual representation of the Sine Saloum region using geographic coordinates. It allows the visualization of cities and their associated infrastructures on a map based on the Sine_Saloum.csv file. The generated map is saved locally as a .png file.

Requirements

Before running the script, make sure you have the following dependencies installed:

  • Python 3.x
  • Pandas
  • Matplotlib

You can install the required dependencies using pip:

pip install pandas matplotlib

How to Use

  1. CSV File Setup:

    • Ensure that the Sine_Saloum.csv file is in the same directory as the executable script.

    • Important: Do not change the file name; it must remain Sine_Saloum.csv.

    • The CSV file should include the following columns:

      • Name: Name of the city or location.
      • Longitude: Longitude of the city.
      • Latitude: Latitude of the city.
      • Altitude: Altitude of the city.
      • Infrastructure: A list of infrastructure codes related to the city.
  2. Adding Infrastructures:

    • To associate an infrastructure with a city, add the relevant code in the "Infrastructure" column of the CSV file.
    • If there are multiple infrastructures for a city, separate the codes with commas.
    • Ensure that the codes are written in uppercase letters as they are case-sensitive.

    Infrastructure Codes:

    • Revenue-Generating Associations:

      • A1: Apiculture
      • A2: Indigo
      • A3: Maraîchage
    • Health & Medical:

      • B1: Albinism
      • B2: Dental
      • B3: Training
      • B4: Ophthalmology
      • B5: Health Post
      • B6: First Aid
    • Education:

      • C1: Digital Library
      • C2: Middle School
      • C3: Community Awareness Center
      • C4: School
      • C5: High School
  3. Running the Script:

    • Once the CSV is set up and placed correctly, run the script:

      python main.py
    • The script will process the CSV file, plot the cities on a map, annotate them with infrastructure information, and save the output as a .png file.

  4. Output:

    • The map will be saved in the same directory as the script with the name response_mono.png.

    • The map will display:

      • City names annotated at their respective coordinates.
      • Infrastructure markers (represented by specific symbols) for each city based on the infrastructure codes in the CSV.

Code Overview

The SineMap class in main.py is responsible for:

  • Loading CSV data: Reads the Sine_Saloum.csv file into a Pandas DataFrame.
  • Creating the Map: Sets up the map's axes, bounding box, and grid.
  • Plotting Points: Places city names and infrastructure markers on the map.
  • Saving and Displaying: Saves the map as a .png file and displays it on the screen.

Key Functions:

  • axes(): Sets up the map's axes, bounding box, grid, and locators.
  • listy(): Moves selected cities to a second DataFrame for further processing.
  • plot(): Plots cities and annotations based on the infrastructure codes.
  • save(): Saves the plot as a PNG image.
  • show(): Displays the plot on the screen.
  • exe_seq(): Executes the full sequence of operations: load, process, plot, save, and display.

Modifying the CSV File

To modify the Sine_Saloum.csv file and add new infrastructure associations:

  • Open the Sine_Saloum.csv file in a text editor or spreadsheet application (e.g., Excel).
  • In the "Infrastructure" column, add the appropriate code(s) for each city.
  • Save the file in CSV format (ensure the name remains Sine_Saloum.csv).
  • Make sure that multiple infrastructure codes are separated by commas, and all codes are in uppercase.

Example of CSV structure:

Name Longitude Latitude Altitude Infrastructure
Diamnadio -16.5740562717412 14.0676469748257 0.40 A1,A3
Moundé -16.6509121553705 13.9549517757492 4.39 C2,A1,B5
Niodor -16.7231394014362 13.8549622993706 3.03 B1,B2,A2
Djirnda -16.6085452104454 13.9788318032727 6.07 C1,C4,A2,A3

Example Output

After running the script, the output will be a map like the following example:

  • The cities will be plotted according to their latitude and longitude.
  • Infrastructure markers will be placed next to each city, with corresponding labels based on the infrastructure codes in the CSV.

For instance, a city like Diamnadio with infrastructure codes A1,A3 will have markers for Apiculture and Maraîchage placed on the map near the city's coordinates. Similarly, Moundé with codes C2,A1,B5 will display markers for Middle School, Apiculture, and Health Post.

Example of output map:

Le Sine Saloum

This map will show the geographic distribution of the cities and their corresponding infrastructures as represented by the markers.

About

This project generates a visual representation of the Sine Saloum region using geographic coordinates. It allows the visualization of cities and their associated infrastructures on a map based on the Sine_Saloum.csv file. The generated map is saved locally as a .png file.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Contributors

Languages