-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a frontend app to have the map,
added deck.gl to the frontend app,
- Loading branch information
Showing
11 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
# Register your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class FrontendConfig(AppConfig): | ||
default_auto_field = 'django.db.models.BigAutoField' | ||
name = 'frontend' |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.db import models | ||
|
||
# Create your models here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Deck.gl Map</title> | ||
<!-- Include Mapbox and deck.gl CDN --> | ||
<script src="https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.js"></script> | ||
<link href="https://api.mapbox.com/mapbox-gl-js/v2.6.1/mapbox-gl.css" rel="stylesheet" /> | ||
<script src="https://unpkg.com/deck.gl@latest/dist.min.js"></script> | ||
</head> | ||
<body> | ||
<div id="map-container" style="width: 100%; height: 500px;"></div> | ||
|
||
<script> | ||
// Mapbox access token | ||
const MAPBOX_ACCESS_TOKEN = "{{mapbox_token}}"; | ||
|
||
// Initialize the deck.gl map | ||
const deckgl = new deck.DeckGL({ | ||
container: 'map-container', | ||
mapboxApiAccessToken: MAPBOX_ACCESS_TOKEN, | ||
mapStyle: 'mapbox://styles/mapbox/light-v9', | ||
initialViewState: { | ||
longitude: -0.88, | ||
latitude: 41.64, | ||
zoom: 12, | ||
pitch: 45, | ||
bearing: 0 | ||
}, | ||
controller: true, | ||
layers: [ | ||
new deck.ScatterplotLayer({ | ||
data: [ | ||
{position: [-122.4, 37.8], size: 100} | ||
], | ||
getPosition: d => d.position, | ||
getRadius: d => d.size, | ||
getFillColor: [255, 0, 0], | ||
}) | ||
] | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from django.test import TestCase | ||
|
||
# Create your tests here. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from django.urls import path | ||
from . import views | ||
|
||
urlpatterns = [ | ||
path('', views.index), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.shortcuts import render | ||
from django.conf import settings | ||
|
||
# Create your views here. | ||
|
||
def index(request): | ||
context = { | ||
'mapbox_token': settings.MAPBOX_ACCESS_TOKEN | ||
} | ||
return render(request, 'frontend/index.html', context) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters