Map package not loading in ArcGIS Runtime SDK for Java

870
0
05-17-2018 10:09 PM
Aditya_Firoda16BCE2184
New Contributor

Hi, I just started using ArcGIS Run-time SDK for Java and was trying to load a map package from a string path but the application loads without showing the base-map and it does not show any image ... 

This is my code and I am using 32-bit Eclipse as my IDE on a 64-bit machine with Windows operating system

package com.mycompany.app;

import java.io.File;

import com.esri.arcgisruntime.data.TileCache;
import com.esri.arcgisruntime.layers.ArcGISTiledLayer;
import com.esri.arcgisruntime.mapping.ArcGISMap;
import com.esri.arcgisruntime.mapping.Basemap;
import com.esri.arcgisruntime.mapping.view.MapView;
//import com.sun.java.util.jar.pack.Package.File;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

public class MyMapApp extends Application {



private MapView mapView;
File tilePackage = new File(pathname"F:\\Project_1\\MyProject\\jodhpur.tpk");
@Override
public void start(Stage stage) throws Exception {

// try {

StackPane stackPane = new StackPane();
Scene scene = new Scene(stackPane);


stage.setTitle("Display Map Sample");
stage.setWidth(800);
stage.setHeight(700);
stage.setScene(scene);
stage.show();

TileCache tileCache = new TileCache(tilePackage.getAbsolutePath());
System.out.println("LOAD STATUS : " + tileCache.getLoadStatus().toString());
ArcGISTiledLayer tiledLayer = new ArcGISTiledLayer(tileCache);
ArcGISMap map = new ArcGISMap(new Basemap(tiledLayer));




//ArcGISMap map = new ArcGISMap(Basemap.createImagery()); */


mapView = new MapView();
mapView.setMap(map);
mapView.enableMousePanProperty();
mapView.enableMouseZoomProperty();
mapView.getMap();
mapView.getLayerViewState(tiledLayer);
mapView.getOperationalLayers().add(tiledLayer);

stackPane.getChildren().addAll(mapView); }
/* } catch (Exception e) {

e.printStackTrace();
}
} */

@Override
public void stop() throws Exception {

if (mapView != null) {
mapView.dispose();
}
}


public static void main(String[] args) {

Application.launch(args);
}

}

Only a blank screen opens that shows it is powered by Esri nothing else any kind of help[ would be appreciated.

Tags (1)
0 Replies