This project is based on - Create a Python app using Azure App Service. Please read same for more information.
Today air pollution has been one of the significant problems to deal with for any nation. People experience a wide range of health effects from being exposed to air pollution.Like people, animals, and plants, entire ecosystems can suffer effects from air pollution. Anybody can take steps to reduce air pollution. So in this project we are going to track air polluted areas using azure map service. It will be easy to reduce pollution of those areas by taking some precautions.
Air pollution can be created by both manmade and natural sources. Natural sources include windblown or kicked-up dust, dirt and sand, volcanic smoke, and burning materials. Manmade sources, meaning that pollution is created by the actions of human beings, tend to be the leading contributor to air pollution in cities and are inherently more able to be influenced by regulations. Manmade sources primarily include various forms of combustion, such as from gas-powered transportation (planes, trains, and automobiles) and industrial businesses (power plants, refineries, and factories), biomass burning (the burning of plant matter or coal for heating, cooking, and energy), and agriculture. In this project we are going to track air polluted areas which will be helpful to take action to prevent air pollution in detected polluted areas.This project is developed using visual Studio Code editor and run in python environment.This project containing CSS and HTML for web page designing. And the very imaportant azure service which is used to track Air Quality is Azure Map Service. Which will show you global map of Air Quality.
- App Service
- Visual Studio Code
- Azure Maps
- Have an Azure account with an active subscription. Create an account for free.
- Install Python 3.6 or higher. add in python path in your environment path.
- Visual Studio Code
- Install Visual Studio Code and the Python Extension
- Create folder and Clon a repository and open same folder in Visual Studio Code.
- In Visual Studio Code, select Terminal > New terminal to open the terminal.
python -m venv .venv
This command creates a virtual environment inside the current folder. Visual Studio Code detects this change and prompts you to select the virtual environment for this folder. Select Yes.- Install pip packages using command
pip install -r requirements.txt
- At the root of your application code folder, create a new environment file named
.env
. - Create Azure map account add primary key in .env file -
MAP_KEY=<your map key>
- Create account on World Air Quality Index and get WQAI_API_KEY. Update
WQAI_API_KEY=<WQAI api key>
- Set up Visual Studio Code to run and debug a Flask app. Then, use your browser to see the app in action.
- In Visual Studio Code, be sure that the app.py file is open in the editor. (Debug options vary based on the file you have open.) In the Activity Bar, select the Run icon. Under the Run and Debug button, select the create and launch.json file link. In the selection drop-down, choose the Flask link.
- When Python:Flask shows in the Run view, select the green arrow to run the application.
- Expected output :
* Serving Flask app "app.py"
* Environment: development
* Debug mode: off
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
- Open link on brower : http://127.0.0.1:5000/
- Deploy project to Azure App Service as part of your continuous deployment (CD) workflows.
- Configure Azure Map key - In the Azure portal, search for and select App Services, and then select your app. In the app's left menu, select Configuration > Application settings.
- In New application setting add key MAP_KEY and value = <your map key>
- Also add key-value for WQAI_API_KEY
- Check deployment after Github action build completed, website link should avilable in Github build as well as Azure App Service.
There are several different ways in which the map can be zoomed, panned, rotated, and pitched. Check different ways to navigate the map using microsoft doc.
The map has a number of keyboard shortcuts built in that make it easier to use the map. These keyboard shortcuts work when the map has focus.