Add raster function to raster data (or project in a smart way)

1169
7
03-03-2017 03:45 PM
KasonBennett
New Contributor

Hello all,

I'm trying to project an image onto a map using SDK 100.0.0. I've been trying to create a json of a raster function to do this projection for each image. 

I've gone over this code, and copy/pasted the example function into a JSON file, but I cannot get the example code to read these functions. (failed to read xxx bytes). Any suggestions?

Thanks, 

Kason

Tags (2)
0 Kudos
7 Replies
nita14
by
Occasional Contributor III

Hi Kason,

As far as I know, ArcGIS Runtime 100.0.0 supports reprojection (not datum transformation) of raster by default. You just need to ensure both map and raster spatial reference's datum are the same and layers should align correctly.

Hope this helps,

Adam 

0 Kudos
KasonBennett
New Contributor

Hey Adam,

Thanks for your reply. I'm still having trouble getting this working. Do you have a working example?

0 Kudos
nita14
by
Occasional Contributor III

Hi,

You can use for example this code:

        Raster raster = new Raster("pathToRasterFile");
        RasterLayer rasterLayer = new RasterLayer(raster);
       
      
        rasterLayer.addDoneLoadingListener(new Runnable(){
            @Override
            public void run() {
                System.out.println(rasterLayer.getSpatialReference().getWkid());
                System.out.println(rasterLayer.getLoadStatus().name());
                System.out.println(rasterLayer.getFullExtent().getCenter().getX());
                System.out.println(rasterLayer.getFullExtent().getCenter().getY());
                mapView.setViewpoint(new Viewpoint(rasterLayer.getFullExtent().getCenter(), 3000));
                        
            }        
        });‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

        map.getOperationalLayers().add(rasterLayer);‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Also, please be aware that raster datum transformation is also supported at 100.0.0. Sorry for my previous misleading information.

Kind regards,

Adam

0 Kudos
KasonBennett
New Contributor

Hello Adam.
Do you have an example of how to do the datum transform? According to the documentation, it's done through loading in a  raster function from a .json file, but I cannot get this to work. 

Thanks,

Kason

0 Kudos
nita14
by
Occasional Contributor III

Kason,

Could you post your code along with the input raster datasets? That would be a lot easier to examine the issue.

Regards,

Adam

0 Kudos
KasonBennett
New Contributor

Adam,

I'm trying to load a raster function. (I think this is how to do the transformations. Is this correct?) I cannot get it to load the json file.

I'm currently just trying to get the example working. (see this) There's no other code or datasets associated with the below code snippet right now, because I cannot get past this point.

testfile.java

public static void testRender()
 {
 RasterFunction rf = new RasterFunction("$PATH_TO_JSON/test.json");
 }‍‍‍‍

test.json

{
 "raster_function":{"type":"Geometric_function"},
 "raster_function_arguments":
 {
  "raster_transform":{"raster_transform":"Raster Transform JSON object","type":"Raster_function_variable"},
  "z_offset":{"double":0,"type":"Raster_function_variable"},
  "z_factor":{"double":1,"type":"Raster_function_variable"},
  "raster":{"is_raster":true,"name":"raster","type":"Raster_function_variable"},
  "type":"Raster_function_arguments"
 },
 "type":"Raster_function_template"
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Thanks,

Kason

0 Kudos
nita14
by
Occasional Contributor III

Hi Kason,

This must be an internal issue in ArcGIS Runtime 100.0.0. If you are current on support, you may want to report an incident.

Regards,

Adam

0 Kudos