A environment for testing technologies composition
- Leaflet
- Flask
- Kafka (This guy was my real motivator for this lab)
Offer a simple and dynamic (Laboratory) web application where we may run Kafka reading maps coordinates on real-time. Each 15 sec the application sends message (Producer) to Kafka topic with coordinates, those coordinates will be read (Consumer) by an endpoint on Leaflet and diplay on satellites icons.
Red satellite icon: Display coordinates on real time from where the ISS at?
Blue satellite icon:
- Display fake coordinates from local file OR
- In case you want to real data this application is ready for running the coordinates from Sentinel 2A satellite. Please to read the section below "Real coordinates from Sentinel 2A"
- Docker
- Docker Compose
- Mapbox: You need to create an account, generate an accessToken and reference this on
leaflet.js
- This is a Mapbox requirement to rendering map on Leaflet, but it's pretty simple Access Token
- Add Mapbox accessToken on code:
- Go to
flaskProject/app/static/js/
and open theleaflet.js
file - Replace
you_mapbox_access_token_here
by your access token
- Go to
Note: Keep in mind the current limit is 1000 transactions/hour
- First of all, should access n2yo to create a register and generates API Key
- After generates you API Key, copy that and paste into
const.py
file:- Go to
flaskProject/app/service/
open the fileconst.py
- Replace
personal_key_here
by the API Key
- Go to
- Adapting the application
- Go to flaskProject/app/ open the file
app.py
- Follow the two simple steps on top comments
- Import: Sentinel2A
- Replace Worker() parameter from "" to
Sentinel2A.SENTINEL2A_URI.value
- Now just read next section "How to run step-by-step"
- Go to flaskProject/app/ open the file
- Clone this repo
- Navigate to root path flaskProject when you w'll see
docker-compose.yaml
andDockerfile
- Compile the docker-compose with:
docker-compose build
- Run docker compose:
docker-compose up -d
- In case you want to see logs run:
docker-compose up
- Go to browser and type 0.0.0.0:5001
See more on Leaflet
A really fun web development framework / microframework (Python)See more on Flask
Apache Kafka is an open-source distributed event streaming platform used by thousands of companies for high-performance data pipelines, streaming analytics, data integration, and mission-critical applications.See more in Apache Kafka
This guys offer all we need to use Kafka esily as possible
See more on Bitnami