This is a React-based web application that visualizes population density across the United States. Users can interact with the map to view population density information for each state. The application features a toggle to display or hide population density colors on the map, along with tooltips showing population details when hovering over states.
- Interactive Map: The application uses OpenLayers to render an interactive map of the United States.
- Population Density Visualization: States are color-coded based on their population density, with an adjustable opacity to see map details.
- Tooltips: Hovering over a state displays a tooltip with the population density information.
- Toggle Density Display: A button to toggle the visibility of the population density colors on the map.
- Login Page: A dummy login page that redirects to the map page upon entering correct credentials.
- React: A JavaScript library for building user interfaces.
- OpenLayers: A high-performance, feature-packed library for creating interactive maps.
- TypeScript: A typed superset of JavaScript that compiles to plain JavaScript.
- Tailwind CSS: A utility-first CSS framework for rapidly building custom designs.
- Node.js and npm installed. You can download them from here.
-
Clone the repository:
git clone https://github.com/kaushiktak19/geovision cd population-density-map
-
Install the dependencies:
npm install
-
Run the application:
npm start
This will start the development server and open the application in your default web browser. The application will be running at
http://localhost:3000
.
src/
: Contains the source code of the application.components/
: Contains the React components used in the application.MapComponent.tsx
: The main map component with population density features.Legend.tsx
: The Legend component to represent population density data.LoginPage.tsx
: The dummy login page component.
App.tsx
: The main application component.index.tsx
: The entry point of the React application.
This project is containerized with Docker, making it easy to deploy and run on your local machine.
- Login to Docker:
Ensure you are logged in to Docker Hub on your terminal.
docker login
- Run docker image
Start the Docker container, mapping port 3000 on your local machine to port 80 in the container.
docker run -it -p 3000:80 kaushikt19/geovision
- Access the application Open your web browser and go to http://localhost:3000 to view the application.
This setup allows you to easily deploy and access the application locally using Docker. You can use any free port instead of 3000.
This section provides instructions for deploying your Dockerized application using Kubernetes. Ensure that you have a working Kubernetes cluster (like Minikube or a cloud-based Kubernetes service) and kubectl
set up on your machine.
-
Pull Docker Image
Ensure your Docker image is built and pushed to a container registry like Docker Hub.docker login docker pull kaushikt19/geovision
-
Create a Kubernetes Deployment
Create a deployment configuration file nameddeployment.yaml
.Apply the deployment using
kubectl
:kubectl apply -f deployment.yaml
-
Expose the Deployment
Create a service configuration file namedservice.yaml
. Apply the service usingkubectl
:kubectl apply -f service.yaml
-
Check the Status
Verify that the deployment and service are running correctly.kubectl get deployments kubectl get services
-
Access the Application
For Minikube, you may need to run the following command to access the LoadBalancer service:minikube service geovision-service
This command will open your default browser to the service URL. Alternatively, you can get the external IP and port by running:
kubectl get services
Access the application at the provided external IP and port. For example, if running locally via Minikube:
http://<EXTERNAL-IP>:<PORT>
To use the dummy login page, you can click the "Show Demo Credentials" button on the login page to view the demo username and password.