77 lines
3.3 KiB
Markdown
77 lines
3.3 KiB
Markdown
# WebGIS SIG Project (Geographic Information System)
|
|
|
|
This repository contains WebGIS applications built for university assignments / learning sessions (Pertemuan 1 to 4).
|
|
|
|
## 🚀 Setup & Installation
|
|
|
|
Follow these steps to set up and run the applications on your local machine.
|
|
|
|
---
|
|
|
|
### 1. Database Setup (MySQL)
|
|
|
|
We have provided a database dump file (`database.sql`) containing the schema and the pre-configured markers for **Pertemuan 1**.
|
|
|
|
#### Method A: Importing via MySQL Workbench (Recommended)
|
|
1. Open **MySQL Workbench** and connect to your local MySQL server.
|
|
2. In the top menu, go to **Server** -> **Data Import**.
|
|
3. Choose **Import from Self-Contained File**.
|
|
4. Click the `...` button and select the [database.sql](file:///Users/danialhb/Downloads/webgisSIG/antigravity/pertemuan%201_stable/webgis_gasstation/database.sql) file located in `pertemuan 1_stable/webgis_gasstation/database.sql`.
|
|
5. Under **Default Schema to be Imported To**, you can leave it blank or click **New...** to create a database named `spbu_gis`.
|
|
6. Click the **Start Import** button at the bottom right.
|
|
7. Once finished, refresh your schemas list to see the `spbu_gis` database and its `locations` table populated with the markers.
|
|
|
|
#### Method B: Importing via Command Line
|
|
If you prefer the command line, run the following command (enter your MySQL root password when prompted):
|
|
```bash
|
|
mysql -u root -p < "pertemuan 1_stable/webgis_gasstation/database.sql"
|
|
```
|
|
|
|
---
|
|
|
|
### 2. Configure Environment Variables
|
|
|
|
Before starting the server, you need to configure your database credentials:
|
|
1. Navigate to the project folder (e.g., `pertemuan 1_stable/webgis_gasstation`).
|
|
2. Duplicate the `.env.example` file and rename it to `.env`.
|
|
3. Open `.env` and fill in your local MySQL password and connection details:
|
|
```env
|
|
DB_HOST=localhost
|
|
DB_PORT=3306
|
|
DB_USER=root # Your MySQL username
|
|
DB_PASSWORD=your_password # Your MySQL password
|
|
DB_NAME=spbu_gis # Database name
|
|
PORT=3000 # App server port
|
|
```
|
|
|
|
*(Note: The `.env` file is excluded from git commits using `.gitignore` to keep your local password secure.)*
|
|
|
|
---
|
|
|
|
### 3. Run the Application
|
|
|
|
Once your database is running and credentials are set:
|
|
1. Open your terminal and navigate to the project directory:
|
|
```bash
|
|
cd "pertemuan 1_stable/webgis_gasstation"
|
|
```
|
|
2. Install the required Node.js dependencies:
|
|
```bash
|
|
npm install
|
|
```
|
|
3. Start the server:
|
|
```bash
|
|
node server.js
|
|
```
|
|
4. Open your web browser and navigate to:
|
|
[http://localhost:3000](http://localhost:3000)
|
|
|
|
---
|
|
|
|
## 📁 Repository Structure
|
|
|
|
* **[pertemuan 1_stable](file:///Users/danialhb/Downloads/webgisSIG/antigravity/pertemuan%201_stable)**: WebGIS Gas Station (includes Leaflet.js client, Express.js backend, and the MySQL database seed file `database.sql`).
|
|
* **[pertemuan 2_stable](file:///Users/danialhb/Downloads/webgisSIG/antigravity/pertemuan%202_stable)**: Intermediate mapping configurations.
|
|
* **[pertemuan 3 (cloropleth & layer)_stable](file:///Users/danialhb/Downloads/webgisSIG/antigravity/pertemuan%203%20(cloropleth%20&%20layer)_stable)**: Chloropleth map with regional boundary layers (JSON layers for Kecamatan boundary and polygon mapping).
|
|
* **[pertemuan 4](file:///Users/danialhb/Downloads/webgisSIG/antigravity/pertemuan%204)**: Advanced map and backend service setup.
|