Transforming Surfaces

Surfaces may be transformed in Manifold using several main methods:


·      Transform Toolbar - The transform toolbar may be used for simple, one-line manipulation of surfaces. The transform toolbar for surfaces is available in all Manifold editions. The optional Surface Tools extension adds new interpolation commands discussed in the Transform - Surface - Interpolate Operators topic.

·      Surface - Transform Dialog - The Transform dialog allows sophisticated manipulation of surfaces via the evaluation of formulas. Formulas can be simple expressions, such as adding one surface to another, or they can include sophisticated program logic using a host of different operators. The Transform dialog is available only if the optional Surface Tools extension has been installed.

·      Surface menu commands - Commands such as Surface - Resize may be used to alter surfaces.

·      Scripting - By writing scripts or other programs surfaces may be changed.


This topic discusses operations using the Surface - Transform dialog. The Surface - Transform menu selection is enabled when the optional Surface Tools extension has been installed and the focus is on a surface window. If you have not activated the Surface Tools extension with a valid serial number you will not be able to use the Surface - Transform command and the capabilities in this topic will not be available.


Many functions in the Surface - Transform dialog can use NVIDIA CUDA for nearly instantaneous computation if our systems are so equipped. See the NVIDIA CUDA topic for details.


The Surface - Transform Dialog




To launch the Transform dialog, open the surface that is to be transformed and choose Surface - Transform in the main menu. The Transform dialog allows us to choose the scope in the upper combo box and to enter a formula into the lower pane. The dialog also includes a Surfaces pane that lists all surfaces in the project. We can double click on a surface in the list to add it to the Formula pane and thus save ourselves the effort of manually entering the name of a surface.


The scope specifies the pixels that will be affected by the transformation, and can be [All Pixels], [Invisible Pixels] or any selection or saved selection made in the surface. Formulas can contain numbers, names of surfaces (names of surfaces must be enclosed in square brackets [ ] if the name contains a space character), arithmetic operations and functions. Formulas are case insensitive. When we press the OK button, each pixel in the surface in the scope will be replaced with the value of the formula for that pixel.


If we would like to preserve the original surface unmodified we can check the Save result as new component box and the system will create a new surface (a copy of the surface which had the focus when the dialog was launched) and put the results of the formula there. The Save result as new component also allows us to surface transformations on a surface that is a read-only component, such as perhaps a surface that has been linked into a project from an Enterprise storage using the Enterprise Edition of Manifold System.


Suppose we have three surfaces named A, B and C. If we open A and invoke Surface - Transform we can enter


A + B


into the Formula pane and press OK. This will set all heights in A to the sum of A + B. If we had entered a formula using the Max() function (one of many Transform Dialog Functions and Operators that may be used) as follows:


Max(A, B + C + 1)


we would have set the height of each pixel in A to either the value of that pixel in A or the value of B + C + 1, whichever is larger.


When evaluating formulas, Manifold automatically handles coordinate system conversions so that a surface in lat / lon and a surface in UTM projection may be used together in a formula. Manifold will also automatically handle type conversions so that a surface with floating-point values for height may be used in a formula together with a surface using integer values for heights.


Invisible pixels are also automatically handled. A formula consisting of just "A" makes all pixels that are visible in A visible in the result, and it makes all pixels that are invisible in A invisible in the result. The formula "A + B" makes all pixels that are visible in both A and B visible in the result, and makes all pixels that are invisible in either A or B invisible in the result.




Suppose we have two surfaces that show the intensity of the downwind chemical plumes from two different releases of a hazardous chemical:




Suppose the releases happened on different days from different positions so that because of changes in wind and release position and amount of chemical released the plumes have different orientations and show different intensities. The two surfaces are called Plume A and Plume B. These surfaces are correctly georegistered to a true location on Earth, so that the inclined rectangle that is the area of interest is exactly at the same location for both surfaces.




Dark green shows zero chemical detected, while brighter green shading to beige to darker colors to white shows increasing levels of exposure. Our task is to sum the two surfaces so we can see what are the values of combined exposure to the two plumes in the area of interest.




This is easy. We first duplicate Plume A and rename it to Combined Plumes. We do this so that the original surface will not be altered when we do a transform.




With the focus on the Combined Plumes surface, we choose Surface - Transform and enter


[Plume A] + [Plume B]


into the Formulas pane. We can save time keyboarding by double clicking on the names of the surfaces in the Surfaces box to add them to the formula instead of typing out them out manually. We press OK.




The surface is transformed so that each pixel now has a value that is the value of that location in Plume A plus the value of that location in Plume B. We can immediately see where the cumulative effects of the plumes are creating "hot spots" not immediately obvious from a visual examination of only Plume A or Plume B.




Note that the pixels that were invisible in both Plume A and Plume B continue to be invisible in the combined result. If we turn on the Layers pane and turn on the Border we can see that a considerable part of the surface is invisible pixels.


Can we use the Transform dialog to make these invisible pixels visible? That also is easy.




We launch the Transform dialog once more and choose [Invisible Pixels] as the scope. In the Formula pane we enter 0. This terse expression simply means to put the value zero into all pixels in the scope, that is, into all pixels that are invisible pixels.




When we press OK the invisible pixels will be filled in with the value 0 so they will be colored the same dark green as all the other zero pixels.




If we combine the surfaces in a map with a drawing of roads we can see where the chemical plumes have combined to generate regions of higher exposure. The illustration uses partial transparency in the surface layer.




We can also add invisible pixels using the Null constant with an expression like that above, which converts all pixels with a value of 100 or less into invisible pixels.




The bright green zone in the combined plumes corresponds to a value of 100 so the formula used renders invisible all pixels except those in the plumes themselves, stripping out the zero-valued dark green pixels.




This may be a more useful effect when combined with other surfaces in a map. The map above shows the surfaces using partial Layer Opacity for each for a better effect.


This is a somewhat contrived example, but it shows the ease with which the Surface - Transform dialog may be used to perform calculations using multiple surfaces.




The Surface - Transform dialog may be used for a variety of utility operations, such as interpolating regions of missing (invisible) pixels.




Suppose we have a surface called Montara that shows the terrain in the region of Montara Mountain, California. The surface has portions with no data, represented with invisible pixels.




We may use the Surface - Transform dialog with the Interpolate(s) function to fill in the missing pixels as seen above. Note that the name could have been cited as simply (Montara) because there are no spaces in the name. However, the example uses ([Montara]) with square brackets [ ] because the name was added by double clicking on the surface name in the Surfaces pane to save having to manually enter the name.




The result is imperfect, but better than having invisible pixels. See the Interpolate Operators topic for additional examples.




Open the Montara Mountain sample surface. Launch the Surface - Transform dialog, check the Save result as new component option and run the following formula:




This will create a flow accumulation surface. Rename the resulting surface Montara Flow.


The following query counts the number of pixels with flow exceeding 10000:


SELECT Count(*) FROM [Montara Flow] WHERE [Height (I)] > 10000;


The following query finds the coordinates of the top 10 maximum flow pixels:


SELECT TOP 10 * FROM [Montara Flow] ORDER BY [Height (I)] DESC;


See the Watersheds topic for additional information on flows.


Available Expressions in Formulas


Formulas may use +, -, * and / as arithmetic operators (addition, subtraction, multiplication and division). Pi (3.1415926…) and Null are the only available constants. Null is used to create invisible pixels.


A vast number of functions and operators are available, and are listed in the Transform Dialog Functions and Operators topic.


Merging Surfaces


It may be tempting to use the Surface - Transform tool to attempt to merge two or more overlapping or non-overlapping surfaces into a single surface. However, this is not something done with the Surface - Transform tool. The Surface - Transform tool takes a surface and sets its pixels to values possibly taken from other surfaces, and then perhaps saves the result as a new surface. It never attempts to enlarge or reduce the surface.


For example, given two surfaces A and B where B is a larger surface that partially overlaps A, the expression A + B operating on surface A will not expand the bounding box of A to include a larger B surface. It will simply set the pixels of the resulting surface (which will be the same size as A) to the sum of values in A and B and make pixels at locations that do not belong to either A or B invisible.


To merge a pair of surfaces together, select all pixels in the first surface, copy them and paste the pixels into the second surface. Make sure the Confirm expanding images or surfaces when pasting option in the Tools - Options - Miscellaneous dialog is turned on.


Short Examples


Given surfaces A, B and C with surface A in feet and surfaces B and C in meters, we may execute the following formulas on surface A:


A + 1


Increases the height of all visible pixels in A by 1.


A * 0.3048


Converts the heights of all visible pixels in A from feet to meters.


IIf(B > 2000, Max(A, B/0.3048), A)


Makes pixels in A at least as high as those in B in regions where the height of B exceeds 2000 meters.


LowPass1(B) + HighPass1(C)


Creates a composite surface (in meters) taking low frequencies from B and high frequencies from C.


A + B/0.3048


Increases the height of all visible pixels in A by the height of the respective pixels in B. Makes pixels in A that are invisible in B invisible.


IIf(HasValue(B, 0, 0), A + B/0.3048, A)


Increases the height of all visible pixels in A by the height of the respective pixels in B. Leaves pixels in A that are invisible in B intact.


IIf(A < 1000, Null, A)


Makes all pixels below 1000 invisible and leaves all other pixels intact.


Tech Tips


·      In case of disaster, single-step Undo works to undo the results of the Transform dialog.


·      The Transform dialog remembers the previous formula. This is very useful together with Undo to make adjustments to formulas that create unexpected results.


See Also



Surface Tools

Transform Dialog Functions and Operators

Transform - Surface - Interpolate Operators