Select to view content in your preferred language

Hello, everyone. How to load local Slpk

572
3
07-23-2022 06:57 AM
yw19841107
New Contributor

Hello, everyone. When I was loading the local slpk file, there was a flash back phenomenon. Please advise me. Here is my code:

SceneView sceneView;
// set the title and size of the stage and show it
Stage stage=new Stage();
stage.setTitle("Display a scene tutorial");
stage.setWidth(800);
stage.setHeight(700);
stage.show();

// create a JavaFX scene with a stack pane as the root node, and add it to the scene
StackPane stackPane = new StackPane();
Scene fxScene = new Scene(stackPane);

stage.setScene(fxScene);

// Note: it is not best practice to store API keys in source code.
// The API key is referenced here for the convenience of this tutorial.
String yourApiKey = "AAPKe82436f57ac0479e84c38cd64354c2b7OJpYBvfcCaLME***********************";
ArcGISRuntimeEnvironment.setApiKey(yourApiKey);

// create a scene view to display the scene and add it to the stack pane
sceneView = new SceneView();
stackPane.getChildren().add(sceneView);


// set the scene on the scene view
sceneView.setArcGISScene(scene);

// add base surface for elevation data
Surface surface = new Surface();
String elevationServiceUrl = "https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer";
surface.getElevationSources().add(new ArcGISTiledElevationSource(elevationServiceUrl));
// add an exaggeration factor to increase the 3D effect of the elevation.
surface.setElevationExaggeration(2.5f);

scene.setBaseSurface(surface);

// add a point scene layer with points at world airport locations
// ArcGISSceneLayer pointSceneLayer = new ArcGISSceneLayer("https://tiles.arcgis.com/tiles/V6ZHFr6zdgNZuVG0/arcgis/rest/services/Airports_PointSceneLayer/SceneS...");
// scene.getOperationalLayers().add(pointSceneLayer);
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(slpkPath);
scene.getOperationalLayers().add(sceneLayer);

//Point cameraLocation = new Point(120.0734669, 31.9008889, 5330.0, SpatialReferences.getWgs84());
//Camera camera = new Camera(cameraLocation, 355.0, 72.0, 0.0);
Camera camera = new Camera(120.0734669,31.9008889, 50, 345, 65, 0);
sceneView.setViewpointCamera(camera);

0 Kudos
3 Replies
yw19841107
New Contributor

Who can help me?

0 Kudos
MarkBaird
Esri Regular Contributor

Can you tell me more about this flashback phenomenon?  Is it temporary whilst data is coming in?

Sometimes as data is loading and elevation sources are loading data will move about.  

Can you also tell me what slpk data you are using?

Maybe post a video as it might help to describe the issue more clearly

0 Kudos
yw19841107
New Contributor

Thank you for your answer. After a day of research, I finally solved it. The error lies in the slpk file converted in osgb format, which cannot be recognized by arcgisruntime. Follow the steps below
1. First, the primary i3s level slpk is produced by "DJI Terra", and the coordinate system is WGS1984; arcgisruntime 3D scene currently only supports this coordinate system;
2. Using ArcGIS pro2.9 (which I currently use, 100 dollars / year, individual users), of course,In "geo processing" - Search and find "upgrade scenario package", press the prompt to enter the primary i3s level slpk file path, set the output path, and click the run button below,
3. After the above is completed, the ArcGIS runtime can be loaded according to the code in my post.

0 Kudos