Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
44268c2
development server successfully getting api data
lylashukur Apr 6, 2025
308d1cf
resolved correct tile path
lylashukur Apr 8, 2025
5c3fa0b
fixed environment variable placement
lylashukur Apr 8, 2025
6a12635
ignore env files
lylashukur Apr 8, 2025
69bae05
fixed Passes information and tiles rendering
lylashukur Apr 9, 2025
d3e7d85
Created React template for migration
lylashukur Apr 9, 2025
5daadae
transfer components
lylashukur Apr 9, 2025
b6e0295
tile generation fully configured
lylashukur Apr 10, 2025
23f9dd9
confirmed Oresat passes shared to frontend
lylashukur Apr 11, 2025
5769767
Add server proxy configuration to resolve CORS issues
lylashukur Apr 12, 2025
69077b1
Update backend/cesium_api/app.py
lylashukur Apr 12, 2025
1a68ee4
Update backend/cesium_api/__main__.py
lylashukur Apr 12, 2025
503f767
Update backend/cesium_api/__main__.py
lylashukur Apr 12, 2025
3243665
Update backend/cesium_api/app.py
lylashukur Apr 12, 2025
b6f6f4a
Update backend/cesium_api/app.py
lylashukur Apr 12, 2025
c783eac
Update backend/cesium_api/__init__.py
lylashukur Apr 12, 2025
2768d06
Update backend/cesium_api/app.py
lylashukur Apr 12, 2025
76c8ecb
Remove entire backup directory
lylashukur Apr 12, 2025
4dfff56
resolve merge conflicts
lylashukur Apr 12, 2025
1878075
Update backend/cesium_api/app.py
lylashukur Apr 12, 2025
879b564
revert tiles.py to main version
lylashukur Apr 12, 2025
f80932c
Merge branch 'Lyla-Migration-React' of https://github.com/uniclogs/ce…
lylashukur Apr 12, 2025
0350601
Delete template vite.config
lylashukur Apr 14, 2025
c9bf49f
Fix various devops bugs
dmitri-mcguckin Apr 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
docker:
python -m pip wheel . -w build --no-deps
python3 -m pip wheel . -w build --no-deps
docker compose build --build-arg VERSION=`grep -i 'version' pyproject.toml | cut -d'"' -f2`

hub:
Expand All @@ -17,4 +17,4 @@ tiles:

clean:
rm -rf build cesium_api.egg-info
pyclean
pyclean
1 change: 1 addition & 0 deletions backend/cesium_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
DEFAULT_HOST = '0.0.0.0'
DEFAULT_PORT = 9000
DEFAULT_DATA_DIR = os.getenv("DATA_DIR", "../data")
DEFAULT_TILES_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "geo-tiles"))
Comment thread
lylashukur marked this conversation as resolved.
Outdated
DEFAULT_API_PREFIX = '/'

SATELLITES = [
Expand Down
3 changes: 2 additions & 1 deletion backend/cesium_api/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from .app import App
from .data import Data
from flask_cors import CORS
from . import APP_NAME, APP_DESCRIPTION, APP_VERSION, SATELLITES, GROUND_STATIONS, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_DATA_DIR, DEFAULT_API_PREFIX
from . import APP_NAME, APP_DESCRIPTION, APP_VERSION, SATELLITES, GROUND_STATIONS, DEFAULT_HOST, DEFAULT_PORT, DEFAULT_DATA_DIR, DEFAULT_API_PREFIX, DEFAULT_TILES_DIR
Comment thread
lylashukur marked this conversation as resolved.
Outdated


LOG = logging.getLogger(__name__)
Expand Down Expand Up @@ -82,6 +82,7 @@ def main():
port=args.port,
api_prefix=api_prefix,
data_dir=args.data_dir,
tiles_dir=DEFAULT_TILES_DIR,
Comment thread
lylashukur marked this conversation as resolved.
Outdated
debug=args.debug,
)
allowed_hosts = ['http://:localhost:3000', 'https://cesium-api.uniclogs.org']
Expand Down
7 changes: 6 additions & 1 deletion backend/cesium_api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from flask import Flask, Blueprint
from flask_cors import CORS
from . import DEFAULT_DATA_DIR
from . import DEFAULT_TILES_DIR
Comment thread
lylashukur marked this conversation as resolved.
Outdated
from .views import view_czml, view_groundstation, view_passes, view_satellite, view_tiles
from .data import Data

Expand All @@ -14,11 +15,12 @@ class App(Flask):

def __init__(
self: App,
data: Data,
data: Data["DATA"],
Comment thread
lylashukur marked this conversation as resolved.
Outdated
host: str = 'localhost',
port: int = 9000,
api_prefix: str = '/',
data_dir: str = DEFAULT_DATA_DIR,
tiles_dir: str = DEFAULT_TILES_DIR,
Comment thread
lylashukur marked this conversation as resolved.
Outdated
debug: bool = False,
):
super().__init__(__name__)
Expand All @@ -27,9 +29,12 @@ def __init__(
self.host = host
self.port = port
self.data_dir = data_dir
self.tiles_dir = tiles_dir or DEFAULT_TILES_DIR
Comment thread
lylashukur marked this conversation as resolved.
Outdated
self.data = data
self.debug = debug

CORS(self, origins=["http://localhost:3000", "https://cesium-api.uniclogs.org"])
Comment thread
lylashukur marked this conversation as resolved.
Outdated

# Register app views
self.register_blueprint(view_czml, url_prefix=f"{api_prefix}/czml")
self.register_blueprint(view_groundstation, url_prefix=f"{api_prefix}/gs")
Expand Down
13 changes: 10 additions & 3 deletions backend/cesium_api/views/tiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@

@view_tiles.route("/<int:zoom>/<int:x>/<int:y>.png")
def get_tile(zoom: int, x: int, y: int):
data_dir = current_app.data_dir
tile_path = abspath(f"{data_dir}/tiles/{zoom}/{x}/{y}.png")

tiles_dir = getattr(current_app, "tiles_dir", "../geo-tiles/tiles")
tile_path = abspath(f"{tiles_dir}/tiles/{zoom}/{x}/{y}.png")
print(f"[TILE DEBUG] Tile path being served: {tile_path}")

#tile_path = abspath(f"{data_dir}/tiles/{zoom}/{x}/{y}.png")
#print(f"[TILE DEBUG] Tile path being served: {tile_path}")



try:
exists(tile_path)
#exists(tile_path)
return send_file(tile_path)
except FileNotFoundError:
return {"err": f"No such tile for {x} by {y} at a zoom of {zoom}"}, 404
Comment on lines 8 to 16

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
@view_tiles.route("/<int:zoom>/<int:x>/<int:y>.png")
def get_tile(zoom: int, x: int, y: int):
data_dir = current_app.data_dir
tile_path = abspath(f"{data_dir}/tiles/{zoom}/{x}/{y}.png")
tiles_dir = getattr(current_app, "tiles_dir", "../geo-tiles/tiles")
tile_path = abspath(f"{tiles_dir}/tiles/{zoom}/{x}/{y}.png")
print(f"[TILE DEBUG] Tile path being served: {tile_path}")
#tile_path = abspath(f"{data_dir}/tiles/{zoom}/{x}/{y}.png")
#print(f"[TILE DEBUG] Tile path being served: {tile_path}")
try:
exists(tile_path)
#exists(tile_path)
return send_file(tile_path)
except FileNotFoundError:
return {"err": f"No such tile for {x} by {y} at a zoom of {zoom}"}, 404
@view_tiles.route("/<int:zoom>/<int:x>/<int:y>.png")
def get_tile(zoom: int, x: int, y: int):
data_dir = current_app.data_dir
tile_path = abspath(f"{data_dir}/tiles/{zoom}/{x}/{y}.png")
try:
exists(tile_path)
return send_file(tile_path)
except FileNotFoundError:
return {"err": f"No such tile for {x} by {y} at a zoom of {zoom}"}, 404

Go ahead and revert this file to what all is on main.

I see you added the tiles_dir and DEFAULT_TILES_DIR fields which is already accomplished via data_dir and DEFAULT_DATA_DIR.

You may dynamically change what the data-dir is by feeding it in as a cmd line parameter like so:

python -m cesium_api --data-dir ../geo-tiles/tiles

File renamed without changes.
File renamed without changes.
94 changes: 94 additions & 0 deletions frontend-next-backup/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Custom

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go ahead and delete the entire frontend-next-backup directory.

We will still have a backup of the old history by being able to go back and look at the history in the git repo.

out

# See http://help.github.com/ignore-files/ for more about ignoring files.

# compiled output
/dist
/tmp
/out-tsc

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# IDEs and editors
.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

# misc
.sass-cache
connect.lock
typings

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*


# Dependency directories
node_modules/
jspm_packages/

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env*

# next.js build output
.next

# Lerna
lerna-debug.log

# System Files
.DS_Store
Thumbs.db
File renamed without changes.
File renamed without changes.
29 changes: 29 additions & 0 deletions frontend-next-backup/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
### Cesium Front-End Application

```bash
cd frontend
```

Install `nodejs` and `yarn` for your system

```bash
sudo apt install nodejs yarnpkg
```

Install JavaScript dependencies

```bash
yarn install
```

Start the app

```bash
yarn dev
```

Goto `localhost3000` in a web browser

[GDAL]:https//gdal.org
[GDAL Download]:https//gdal.org/download.html
[CesiumJS]:https//github.com/CesiumGS/cesium
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import 'bootstrap/dist/css/bootstrap.min.css';

const imageryProvider = new UrlTemplateImageryProvider({
url: BACKEND_REST_API + '/tiles/{z}/{x}/{reverseY}.png',
url: BACKEND_REST_API + '/tiles/{z}/{x}/{y}.png',
tilingScheme: new GeographicTilingScheme(),
maximumLevel: 5,
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Shared constants
const REST_API = process.env.NEXT_PUBLIC_API_BASE_URL;
export const BACKEND_REST_API = REST_API || `https://cesium-api.uniclogs.org`;
console.log(`[ENV]: Using Rest API at ${BACKEND_REST_API}`)

Expand All @@ -10,4 +11,4 @@ export const CESIUM_CREDIT = '<a href="https://cesium.com/" target="_blank"><img
// PSU coordinates
export const HOME_LAT_DEG = 45.523064;
export const HOME_LONG_DEG = -122.676483;
export const HOME_ALT_M = 25000000.0;
export const HOME_ALT_M = 25000000.0;
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ function UpcommingPassesModal({ show, handleClose }) {
const [passes, setPasses] = useState(PASSES_DEFAULT);

useEffect(() => {
fetch(`${BACKEND_REST_API}/passes/${gs}/${sat}`)
fetch(`${BACKEND_REST_API}/passes/${gs}/${sat}`)
.then(response => response.json())
.then(data => {

setPasses(data);
});
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ services:
build:
context: .
ports:
- '3000:3000'
- '7008:3000'
env_file:
- .env.production
File renamed without changes.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions frontend-next-backup/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "uniclogs-cesium",
"version": "1.0.2",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"postinstall": "symlink-dir node_modules/cesium/Build/Cesium public/cesium"
},
"dependencies": {
"bootstrap": "5.3.3",
"cesium": "1.124.0",
"next": "15.2.3",
"prop-types": "^15.8.1",
"react": "18.3.1",
"react-bootstrap": "2.10.6",
"react-dom": "18.3.1",
"resium": "^1.18.2"
},
"devDependencies": {
"eslint": "^9.16.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-next": "15.0.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-jsx-a11y": "^6.10.0",
"eslint-plugin-react": "^7.37.2",
"eslint-plugin-react-hooks": "^5.0.0",
"symlink-dir": "^6.0.3"
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading