Can i use .tif, .jpg or .bmp surface images for creating a basemap? I use .tpk files from ArcGIS Pro as world surface image but i want to try other formats(.tif is preferable). What i use now that works but only with .tpk files:
TileCache tileCache = new TileCache("C:\\Users\\user\\Downloads\\WorldImagery1.tpk");
ArcGISTiledLayer[] tiledLayers = new ArcGISTiledLayer[1];
tiledLayers[0] = new ArcGISTiledLayer(tileCache);
Basemap basemap = new Basemap(Arrays.asList(tiledLayers), null);
arcscene = new ArcGISScene(basemap);
sceneView.setArcGISScene(arcscene);
Solved! Go to Solution.
The problem was in CRS of my .tif images. Using Define Projection tool in ArcGIS Pro i changed CRS to the right CRS(EPSG 3857 in my case) and images started to display.
Tile packages (.tpk) are highly optimised file formats for showing basemap data. They are split up into many small tiles of data and for each level of detail there is a set of tiles which are designed to work at a given scale range. If you've got a huge amount of data then these are the best way to go. Remember using ArcGIS Pro you can create your own.
We do however have support for adding most raster formats of data onto a map too. The data does need to be geo-referenced raster data which means the file has information about the geographic location of the corners of the raster data. This tells us where to display it. If your data is not geo-referenced then I can help you with this if you have access to ArcMap or ArcGIS Pro.
So assuming you have geo-referenced raster data data you can add your own raster layers. Will support a load of formats such as ASRP, CRF, DTED, GeoTIFF/TIFF, HFA, HRE, IMG, JPEG, JPEG2000, NITF, PNG, RPF, SRTM (HGT), USGS DEM.
There is a simple sample which shows you how to add a raster layer from a single file:
https://github.com/Esri/arcgis-runtime-samples-java/tree/master/raster/raster-layer-file
Does this help?
Thank you. I tried like in the link but it doesn't work. After program starts the Earth surface on the screen is empty without any data. Maybe i have some problem in my code. I have opened this .tif file with ArcGIS Pro without any problems. (It is georeferenced country surface image. It weighs 100gb)
private void addCountrySurface()
{
Raster raster = new Raster("E:\\Map\\countrySurface.tif");
RasterLayer rasterLayer = new RasterLayer(raster);
//rasterLayer.loadAsync();//tried with loadAsync() it doesn't work too
rasterLayer.addDoneLoadingListener(() -> {
if (rasterLayer.getLoadStatus() == LoadStatus.LOADED) {
JOptionPane.showMessageDialog(null, "Map downloaded");
} else {
JOptionPane.showMessageDialog(null, "Error");
}
});
arcscene.getOperationalLayers().add(rasterLayer);
}
I've tried out your code with the sample data and it's displaying for me:
I did however want to make sure I'd read your message correctly. Is your file 100Gb (Gigabytes) in size? If it really is that big, we might need to come up with a strategy for chopping it up.
Thank you. I'll try to chop.
Chopping into smaller tiles and building pyramids on the raster data will help too.
If you are however just using the raster data as a basemap, then do consider making a tile package. To make things easy, make sure you use the ONLINE tiling scheme.
https://pro.arcgis.com/en/pro-app/latest/tool-reference/data-management/create-map-tile-package.htm
I can't add .tiff image to my scene. I tried with lighter .tif images(with weight about 100mb) but it doesn't work too. It works only with .tpk packages created from .tif images(and i have problem with creating .tpk package from big .tif images). Maybe my code sample for drawing .tif raster images is wrong?
Are you able to display the tif file which is used in this sample:
https://github.com/Esri/arcgis-runtime-samples-java/tree/master/raster/raster-layer-file
This will display the raster in a 2D MapView application, but you should be able to display this in a scene view too. I adapted your code sample above to zoom to the data so you don't have to find it:
private void addCountrySurface()
{
Raster raster = new Raster("Shasta.tif");
RasterLayer rasterLayer = new RasterLayer(raster);
rasterLayer.addDoneLoadingListener(() -> {
if (rasterLayer.getLoadStatus() == LoadStatus.LOADED) {
System.out.println("raster added");
Envelope extent = rasterLayer.getFullExtent();
Viewpoint viewpoint = new Viewpoint(extent);
sceneView.setViewpoint(viewpoint);
} else {
System.out.println("Error");
}
});
scene.getOperationalLayers().add(rasterLayer);
}
It is also worth noting that in 3D SceneView applications you need to be fairly zoomed in to see the raster layers, so maybe you are not seeing the raster data because you are too far zoomed out.
Thank you. Doesn't work. Raster image is ok.
private void addCountrySurface()
{
Raster raster = new Raster("Shasta.tif");
RasterLayer rasterLayer = new RasterLayer(raster);
rasterLayer.addDoneLoadingListener(() -> {
if (rasterLayer.getLoadStatus() == LoadStatus.LOADED) {
System.out.println("raster added");
Envelope extent = rasterLayer.getFullExtent();
Viewpoint viewpoint = new Viewpoint(extent);
sceneView.setViewpoint(viewpoint);
scene.getOperationalLayers().add(rasterLayer);//tried like this, but it doesnt work. In previouse variant it seems this method works before addDoneLoadinglistener() ends.
} else {
System.out.println("Error");
}
});
}
When you say it doesn't work, how does this is not work? Does it load but not display, or just not load? Are you using the sample data I suggested?
Maybe you can also provide more information like the version of SDK, OS, JDK etc so I can check things.
This is what I'm seeing with this data.
At the moment I can't see what's wrong here as for me as shown in a picture earlier in this thread it loads okay and I've seen it working on macOS and Windows.