How do I load a catalog of RPF (CADRG) Map tiles?

2107
5
03-13-2017 01:09 PM
GeoffMatrangola
New Contributor

How do I load a catalog of RPF (CADRG) Map tiles using the Java version 10.2.4 or version 100? I was able to load a single tile using  RasterLayer rasterLayer = new RasterLayer(new FileRasterSource("filepath")) but I can't seem to find the API to load the directory full of RPF/CADRG/NITFS files as the base map similar to what I get when we use ArcGISTiledMapServiceLayer.

0 Kudos
5 Replies
nita14
by
Occasional Contributor III

Geoff,

There is no such method in 10.2.4, neither at 100.0.0 (but you can add mobile mosaic dataset). So, you need to iterate through each raster in the directory.

Regards,

Adam

0 Kudos
GeoffMatrangola
New Contributor

Adam,

Thanks. I was able to load the files onto a RasterLayer using Java SDK 100. However, I cannot get it to display the RPF raster (aerial photographs) layers over a basemap. If I I set the basemap I cannot see the RasterLayer. If I comment out the call to setBasemap() it will display the RPF layer with no basemap and the extent set to the first RasterLayer. I've tried it with and without the StrechRenderer, it behaves the same.

I think this is what you meant by "iterate through each raster in the directory"...

      map = new ArcGISMap();
      map.setBasemap(Basemap.createLightGrayCanvasVector());
      List<Double> minValues = Arrays.asList(1.61, 3.14);
      List<Double> maxValues = Arrays.asList(3.22, 6.28);
      StretchParameters stretchParameters = new MinMaxStretchParameters(minValues, maxValues);
      RasterRenderer stretch = new StretchRenderer(stretchParameters, null, true, null);
      File dir = new File("C:\\maps\\RPF");
      for (File file : dir.listFiles()) {
         if (file.getName().endsWith(".i42")) {
            Raster raster = new Raster(file.getAbsolutePath());
            RasterLayer layer = new RasterLayer(raster);
            layer.setRasterRenderer(stretch);
            map.getOperationalLayers().add(layer);
         }
      }

      //create the MapView and assign its map
      mapView = new MapView();
      mapView.setMap(map);

The examples I found on the Esri section of GitHub just load one Raster in a single RasterLayer. Also, I could only find a little information about a mosaic dataset. MosaicDatasetRaster| arcgis-java  However, I couldn't find any information on the format of the Raster Database File that is the first Parameter of the constructor. I feel as though I have glossed over some vital bit of documentation on both the RasterLayer and MosaicDatasetRaster. I'd be grateful if you could point me in the right direction.

I was able to use ArcGIS Explorer to load the maps and the raster images exactly as I want them. The base map, then the photos overplayed at their correct positions.

Thanks again,

Geoff

0 Kudos
nita14
by
Occasional Contributor III

Geoff,

Regarding  mosaic datasets, please refer to ArcGIS documentation What is a mosaic dataset?—Help | ArcGIS for Desktop. Speaking about mobile mosaic dataset, you can create those using this tool Mosaic Dataset To Mobile Mosaic Dataset—Data Management toolbox | ArcGIS Desktop.

Referring to the issues with RPF files, I can only suspect it is related to their spatial reference, but without any sample data I cannot say anything 100% sure.

Regards,

Adam

0 Kudos
GeoffMatrangola
New Contributor

Adam,

Thanks again for your quick reply. I looked into creating a mobile mosaic data set, but I fear my users would prefer to just point my app to the RPF files and have them loaded up instead of having to do a conversion process with ArcGIS Desktop first. Unfortunately, I can't share the files with anyone. But I added a few lines to see what was going on with the spatial reference.

layer.addDoneLoadingListener(() -> {
   SpatialReference sr = layer.getSpatialReference();
   if (sr != null)  System.out.println(sr.getWKText());
});

and 

map.addDoneLoadingListener(() -> {
   System.out.println(map.getSpatialReference().getWKText());
});

I get...
PROJCS["WGS_1984_Web_Mercator_Auxiliary_Sphere",GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Mercator_Auxiliary_Sphere"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["Central_Meridian",0.0],PARAMETER["Standard_Parallel_1",0.0],PARAMETER["Auxiliary_Sphere_Type",0.0],UNIT["Meter",1.0]]
Licensed For Developer Use Only
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]

Which looks like the base map and the Raster Layers are both the same projection? Am I reading that right? Should set the z-order of the raster images or something?

0 Kudos
nita14
by
Occasional Contributor III

Geoff,

Actually, the basemap is in 102100 WKID and your data in 4326 WKID. Check what is happening when ensuring the same spatial reference for all layers. Just add as a basemap this service ESRI_Imagery_World_2D (MapServer)  which is in 4326 WKID. Do the RPFs appear on the map? Do the align correctly? If negative, coordinate system is not the issue you are looking for.

Regards,

Adam

0 Kudos