Guide to Orthomapping (Part 3)

Continued from Part 2

Previously, Part 1 has introduced the concept of Orthomapping, the pre-requisite configuration environment for orthomapping tools to run on, and how to organize imageries and create imagery collection layer item, and Part 2 of this guide has covered how to apply block adjustments, manipulate control points, and compute seamlines and color correction, and procedures in generating orthomosaic, DEM, and Vegetation Indices through orthomapping tool.

Next, in Part 3, we will talk about how to handle the processed imageries, which includes how to add/delete images in the image collection, and reset/delete the image collection.

Let's get started! First, get connected to your GIS instance.

import arcgis
from arcgis.gis import GIS

portal_url = "https://yourportal.domain.com/portal"
portal_username = "your username"
portal_password = "your password"

gis = GIS(url=portal_url, username=portal_username, password=portal_password)

The Image Collection Layer item has already been created in Part 1, so let us reuse the reference to the layer item here.

image_collection_item = gis.content.search("omImageCollection")[0]
image_collection_item.url
'https://yourportal.domain.com/server/rest/services/Hosted/omImageCollection/ImageServer'

Step 4. Managing imagery

4.1 Get or set image collection processing status

arcgis.raster.orthomapping.get_processing_states() and arcgis.raster.orthomapping.alter_processing_states() are used to query and change processing states. The states are normally set based on orthomapping processes performed on image collection. It is important as it will determine how the data will be handled in the further orthomapping workflows.

from arcgis.raster.orthomapping import get_processing_states
get_processing_states(image_collection=image_collection_item)
{'blockadjustment': 'full',
 'dem': {'match_mode': 'ETM',
  'object_size': 15,
  'ground_spacing': None,
  'minimum_pairs': 8,
  'minimum_adjustment_quality': 0.2,
  'maximum_diff_gsd': 2,
  'maximum_diff_OP': 8,
  'interpolation_method': 'TRIANGULATION',
  'smooth_method': 'GAUSS5X5',
  'surface_type': 'DSM'},
 'seamlines': {'computation_method': 'DISPARITY',
  'blend_width': None,
  'blend_type': 'BOTH',
  'request_size': 1000,
  'request_size_type': 'PIXELS',
  'blend_width_units': 'PIXELS',
  'min_region_size': 100,
  'min_thinness_ratio': 0.05,
  'max_sliver_size': 20},
 'colorcorrection': {'balancing_method': 'DODGING',
  'surface_type': 'SINGLE_COLOR'},
 'adjust_index': 2,
 'imagetype': 'UAV/UAS'}
from arcgis.raster.orthomapping import alter_processing_states

new_states ={'blockadjustment': 'quick',
             'dem': '',
             'seamlines':{'computation_method': 'DISPARITY',
                          'blend_width': None,
                          'blend_type': 'BOTH',
                          'request_size': 1000,
                          'request_size_type': 'PIXELS',
                          'blend_width_units': 'PIXELS',
                          'min_region_size': 100,
                          'min_thinness_ratio': 0.05,
                          'max_sliver_size': 20},
             'colorcorrection': {'balancing_method': 'DODGING',
                                 'surface_type': 'SINGLE_COLOR'},
             'adjust_index': 1,
             'imagetype': 'UAV/UAS'}

alter_processing_states(image_collection=image_collection_item, new_states=new_states)
{'orthomapping': {'blockadjustment': 'quick',
  'dem': '',
  'seamlines': {'computation_method': 'DISPARITY',
   'blend_width': None,
   'blend_type': 'BOTH',
   'request_size': 1000,
   'request_size_type': 'PIXELS',
   'blend_width_units': 'PIXELS',
   'min_region_size': 100,
   'min_thinness_ratio': 0.05,
   'max_sliver_size': 20},
  'colorcorrection': {'balancing_method': 'DODGING',
   'surface_type': 'SINGLE_COLOR'},
  'adjust_index': 1,
  'imagetype': 'UAV/UAS'}}

4.2 Add images to image collection

arcgis.raster.analytics.add_image() can help add new images to an exisiting image collection. This will not change anything else associated with other images, e.g., existing seamlines, footprints, control points, etc.

from arcgis.raster.analytics import add_image
image_item = gis.content.search("YUN_0040.JPG")[0]
raster_type_params = {
    "gps":[["YUN_0040.JPG",34.006989,-117.09279,725.13]], "isAltitudeFlightHeight":"False",
    "cameraProperties":{"maker":"Yuneec", "model":"E90", "focallength":8,"columns":5472, "rows":3648, "pixelsize":0.0024},
    "averagezdem":{
        "url":"https://elevation3d.arcgis.com/arcgis/rest/services/WorldElevation3D/Terrain3D/ImageServer"
    }
}
add_image(image_collection=image_collection_item, input_rasters=[image_item], raster_type_name="UAV/UAS", 
          raster_type_params=raster_type_params)
'https://yourportal.domain.com/server/rest/services/Hosted/omImageCollection/ImageServer'

4.3 Delete images from image collection

arcgis.raster.analytics.delete_image() can help remove existing images from an image collection. This will not change anything else associated with other images, e.g., existing seamlines, footprints, control points, etc.

from arcgis.raster.analytics import delete_image
delete_image(image_collection=image_collection_item, where="objectID=5")
'https://yourportal.domain.com/server/rest/services/Hosted/omImageCollection/ImageServer'

4.4 Reset image collection

arcgis.raster.orthomapping.reset_image_collection() can help reset an image collection imagery layer item to its original state.

It will reset the block adjustment results that are already computed for the images, rebuild footprints, reset seamlines, and remove color correction results.

It will not remove the existing control points feature class, flight path feature class, etc, that have been calculated from previous block adjustment run.

It will not remove the derived products from adjusted image collection.

from arcgis.raster.orthomapping import reset_image_collection
reset_image_collection(image_collection=image_collection_item)
True

4.5 Delete image collection

arcgis.raster.analytics.delete_image_collection() can help delete an image collection imagery layer item from our ArcGIS Enterprise.

All other associated results and products that are not stored together with image collection will remain.

from arcgis.raster.analytics import delete_image_collection
delete_image_collection(image_collection=image_collection_item)
True

Conclusion

In this guide, we have gone through a total of four steps in handling imageries, and generating orthomapping products, namely:

  • Step 1. Getting Organized, in which we will discuss how to create image collection layer item from multiple images;
  • Step 2. Getting Adjusted, that will introduce how to apply block adjustments, manipulate control points, and compute seamlines and color correction.
  • Step 3. Getting Results, in which we will talk about procedures in generating orthomosaic, DEM, and Vegetation Indices through orthomapping tools.
  • Step 4. Managing Imageries, that will demonstrate how to add/delete images in the image collection, and reset/delete the image collection.

Now with orthomapping products such as a DTM or DSM, and an orthomosaic with aerial digital imagery, etc. being obtained using Python API methods, you can go on to do all kinds of analysis with elevation data, or use your orthomosaic map for applications in emergency response, resource management, real estate, and more [1].

References

[1] Lenhardt, Ortho Mapping in ArcGIS Pro Part III: Getting Results,https://www.esri.com/arcgis-blog/products/arcgis-pro/imagery/ortho-mapping-products-arcgis-pro/ [Online][Assessed on August 13, 2019]

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.