Introduction
In this tutorial, you'll learn how to create a simple web application that displays information about data centers and their environmental impact. This project will help you understand how technology companies are addressing concerns about data center construction in urban areas, like the situation in Philadelphia where officials are considering building data centers in neighborhoods previously affected by industrial pollution.
By the end of this tutorial, you'll have built a basic web interface that shows data center locations and environmental impact information, similar to what city planners and environmental groups might use to evaluate proposed facilities.
Prerequisites
To follow this tutorial, you'll need:
- A computer with internet access
- A web browser (Chrome, Firefox, or Safari)
- A code editor like Visual Studio Code or Atom
- Basic understanding of HTML, CSS, and JavaScript
- No prior experience with web development frameworks required
Step-by-Step Instructions
1. Create the Project Structure
First, create a new folder on your computer called data-center-project. Inside this folder, create three files: index.html, style.css, and script.js. This structure will organize our web application components.
2. Set Up the HTML Foundation
Open index.html and add the basic HTML structure:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Center Impact Viewer</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>Data Center Impact Viewer</h1>
<p>Understanding the environmental impact of data center construction</p>
</header>
<main>
<div id="map-container"></div>
<div id="data-center-list"></div>
</main>
<script src="script.js"></script>
</body>
</html>
3. Create Basic Styling
Open style.css and add the following CSS to make your web page visually appealing:
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
background-color: #f5f5f5;
}
header {
background-color: #2c3e50;
color: white;
padding: 20px;
text-align: center;
}
main {
display: flex;
flex-wrap: wrap;
padding: 20px;
gap: 20px;
}
#map-container {
flex: 1;
min-width: 300px;
height: 400px;
background-color: #e0e0e0;
border: 1px solid #ccc;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
}
#data-center-list {
flex: 1;
min-width: 300px;
background-color: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.data-center-card {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 4px;
padding: 15px;
margin-bottom: 10px;
}
.data-center-card h3 {
margin-top: 0;
color: #2c3e50;
}
.data-center-card p {
margin: 5px 0;
color: #666;
}
4. Add JavaScript Functionality
Open script.js and add the following JavaScript code to create sample data centers and display them:
// Sample data center information
const dataCenters = [
{
id: 1,
name: "Philadelphia Data Center",
location: "West Philadelphia",
status: "Proposed",
environmentalImpact: "High - Near former oil refinery site",
energyUsage: "100 MW",
description: "This proposed facility would be built on land previously used by an oil refinery that was closed in 2015. Environmental concerns include soil contamination and groundwater impact."
},
{
id: 2,
name: "GreenTech Data Center",
location: "Downtown",
status: "Operational",
environmentalImpact: "Medium - Modern facility with renewable energy",
energyUsage: "50 MW",
description: "This operational center uses 100% renewable energy and has minimal environmental impact."
},
{
id: 3,
name: "UrbanTech Hub",
location: "North Philadelphia",
status: "Under Construction",
environmentalImpact: "Medium - Mixed industrial site",
energyUsage: "75 MW",
description: "Built on former industrial land with remediation completed."
}
];
// Function to display data centers
function displayDataCenters() {
const container = document.getElementById('data-center-list');
// Clear existing content
container.innerHTML = '';
// Add each data center to the display
dataCenters.forEach(center => {
const card = document.createElement('div');
card.className = 'data-center-card';
card.innerHTML = `
${center.name}
Location: ${center.location}
Status: ${center.status}
Environmental Impact: ${center.environmentalImpact}
Energy Usage: ${center.energyUsage}
${center.description}
`;
container.appendChild(card);
});
}
// Initialize the page when it loads
window.addEventListener('load', function() {
displayDataCenters();
// Add a simple map simulation
const mapContainer = document.getElementById('map-container');
mapContainer.innerHTML = 'Map visualization of data center locations
';
});
5. Test Your Application
Open your index.html file in a web browser. You should see a header with the title, a map container, and a list of data centers. The list shows information about each facility including location, status, environmental impact, and energy usage.
6. Enhance with Real Data (Optional)
To make this more realistic, you could expand this project by:
- Adding real data center information from public databases
- Integrating with mapping APIs like Google Maps or Leaflet
- Adding interactive elements to filter data centers by status or impact level
- Creating a form for users to submit new data center information
Summary
In this tutorial, you've created a basic web application that displays information about data centers and their environmental impact. This project demonstrates how technology can help city planners and environmental groups evaluate proposed facilities, similar to the situation in Philadelphia where officials are considering data center construction in neighborhoods previously affected by industrial pollution.
The application shows how data center information can be organized and displayed in a user-friendly way, which is crucial when communities are concerned about the environmental impact of new industrial developments. By understanding how to build such tools, you're learning skills that could be applied to real-world environmental impact assessments and urban planning projects.



