-
Notifications
You must be signed in to change notification settings - Fork 146
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GeoServerTerrainProvider is not defined #64
Comments
Hi, I don't work with angular but from your images and code, I understand that you didn't import |
I Included the js file in the html file. But I even tried in cesium which had another issue <title>Cesium Terrain with GeoServer</title> <script src="../../Build/Cesium/Cesium.js"></script> <script src="../../Build/Cesium/GeoserverTerrainProvider.iife.js"></script> <style> html, body, #cesiumContainer { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden; background-color: #000; } </style> <script> // Initialize Cesium Viewer console.log("Initializing Cesium Viewer..."); const viewer = new Cesium.Viewer('cesiumContainer', { timeline: false, animation: false, imageryProvider: false, baseLayerPicker: false }); console.log("Cesium Viewer initialized:", viewer);
|
did you try iife file and calling only |
Hi, I was trying to use the terrain provider in one of my angular apps. But I'm facing the below issue. I use the geotiff translator in the repo to translate my 16 bit grayscale data and uploaded the layer as mentioned in the repo. Can you help me out with this.
note: I'm using cesium 1.122
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
declare let Cesium: any;
declare let GeoServerTerrainProvider: any; // Make sure this is globally available
@component({
selector: 'app-cesium',
templateUrl: './cesium.component.html',
styleUrls: ['./cesium.component.scss'],
})
export class CesiumComponent implements OnInit {
private viewer: Cesium.Viewer | undefined;
constructor(private router: Router) {}
ngOnInit(): void {
// Set Cesium base URL
Cesium.buildModuleUrl.setBaseUrl('/assets/Cesium/');
}
private async initializeViewer(container: HTMLElement): Promise {
try {
// Initialize GeoServer terrain provider
const terrainProvider = new GeoServerTerrainProvider({
url: 'http://localhost:8080/geoserver',
layerName: 'elevation:SRTM90', // Terrain layer from GeoServer
});
}
// Fly to a specific location on the map (default home view)
goHome(): void {
if (this.viewer) {
this.viewer.camera.flyTo({
destination: Cesium.Rectangle.fromDegrees(
88.7402, // West Longitude
27.3448, // South Latitude
96.2845, // East Longitude
33.6511 // North Latitude
),
});
}
}
// Switch to 2D map view (if needed)
switchTo2D(): void {
this.router.navigate(['/home/map']);
}
}
also when I tried console log it says undefined
The text was updated successfully, but these errors were encountered: