Intrinsic Fields in Tables

Fields that appear in tables are normally ordinary data fields. These may be a part of the table, or they may appear in a table as a result of a relation . For a drawing's table, Manifold also can display fields generated by the system for each record. These are fields that describe some system attribute of the object represented by that record, or which are computed from the geometry of the object. Such system-generated fields are called intrinsic fields.

Intrinsic columns are not shown by default in tables. We can use the View - Columns command to show intrinsic fields. Intrinsic fields have an (I) as part of their name in the Columns dialog. Intrinsic fields will also appear in the Object Fields dialog, which may be called from the context menu that pops up when right-clicking on an object in a drawing.

Intrinsic fields are an intrinsic part of the table and cannot be deleted with the Table - Design dialog. They may be used as key fields for relations or for other purposes just like ordinary data fields.

Intrinsic Fields

 Area (I) Object area. Bearing (I) 0 for points and areas. For lines, the bearing in degrees of a straight line segment constructed between the first and last points of the very first branch within the line. Computed using ellipsoidal trigonometry. 90 is East and 270 is West. Branches (I) The number of branches (indicates topologically branched objects, such as areas with holes or islands). Coordinates (I) The number of coordinates that define the object. Geom (I) The geometry data ("the object metric") that defines the position and shape of the object. Read/write. Modifying this column with, say, an UPDATE query, modifies the metric of the associated drawing objects. Setting Geom (I) to a NULL value or to a geometry value the type of which differs from that of the drawing object is not allowed. Latitude (I) Latitude of the center of the object in degrees latitude. Length (I) Object length (or perimeter). Longitude (I) Longitude of the center of the object in degrees longitude. Selection (I) Boolean: currently selected or not. Selection Mask (I) A byte giving the saved selections mask. Type (I) A lookup field for object type: area, line or point. Version (I) Current version of the drawing object. Changing the metric of a drawing object increments the value of the Version (I) column. For a linked drawing which uses a version column to facilitate multi-user editing, the values in the Version (I) column will be the same as the values in the version column. X (I) X coordinate of the center of the object in the coordinate system used by the drawing. Y (I) Y coordinate of the center of the object in the coordinate system used by the drawing.

Columns for intrinsic fields will be shown using a different font color, with a different color being used for read-only intrinsic fields such as the Selection Mask.

The Geom (I), X (I), Y (I), Latitude (I), and Longitude (I) fields are editable. Changing these fields will move or in the case of Geom (I) will edit the object. These fields are normally used to move the position of points. They may also be used to move the centers of areas or lines, in which case they result in a change to all coordinates defining the line or area required by the horizontal or vertical displacement of the center. See the Editing Intrinsic Fields in Tables topic and also the Geometry in Tables topic for information about geoms.

The intrinsic fields may be used like other fields in the table. For example, the table may be sorted by clicking on the column head for an intrinsic field. This allows some remarkable uses of tables. For example, one can sort all objects in the table from lowest latitude to highest (that is, from South to North) by simply clicking on the Latitude (I) column head. We could then click and shift-click to select objects in a desired range of latitudes.

Intrinsic fields may also be used in SQL queries, Active Column formulas and other uses where an ordinary field might be used. Note that since intrinsic fields have an "(I)" as part of their names they must be used within square brackets in SQL, as in

SELECT [Latitude (I)] FROM mytable WHERE [Latitude (I)] > 60;

The Geom (I) field is especially useful for manipulating geometry from queries, such as the following three examples:

UPDATE [A] SET [Geom (I)] = Buffer([Geom (I)],10);

INSERT INTO B ([Geom (I)]) VALUES (NewPointLatLon(30, 40));

SELECT Centroid([Geom (I)]) FROM C;

...where A, B and C are drawing names.

Native Coordinates

Native coordinates or native units are numbers stored within the drawing that Manifold uses internally as positional coordinates. These numbers are shown in the Object Coordinates dialog that pops up if you right-click an object and choose Coordinates. They are also used in the X (I) and Y (I) intrinsic field columns.

Projected coordinates are native coordinates adjusted with the local scale and local offset parameters of the coordinate system (projection) in use. In many cases, projected coordinates are the same as native coordinates (because of the local scale and offset values) but sometimes they are different.

The relationship between projected coordinates, native coordinates and the local scale and local offset parameters may be expressed in pseudo-code as:

ProjectedX = NativeX * LocalScaleX + LocalOffsetX

ProjectedY = NativeY * LocalScaleY + LocalOffsetY

Each object may participate in the selection and in one or more of any of seven possible saved selections. Whether or not the object is selected or is a member of one of the seven selection sets is coded bitwise into a single byte, the Selection Mask.

Length and Area Units

The Area (I) and Length (I) intrinsic fields report the area and length of the object based upon two factors:

§      The coordinate system in use: latitude / longitude drawings always use degrees as units while projected drawings will report using either meters or feet.

§      The setting of the Use English measurement units checkbox in the Tools - Options dialog. This is the same box that specifies units for the Tracker tool. If this checkbox is checked, units for projected drawings will be reported in feet. If it is not checked, units for projected drawings will be reported in meters.

The above rules also may be summarized as follows:

·      If the drawing is in Latitude / Longitude (that is, unprojected) Length (I) is reported in degrees and Area (I) is reported in square degrees.

·      If the drawing is projected and the Use English measurement units option is turned off, Length (I) is reported in meters and Area (I) is reported in square meters.

·      If the drawing is projected and the Use English measurement units option is turned on, Length (I) is reported in feet and Area (I) is reported in square feet.

For example, projected drawings will use coordinate systems in meters or feet, resulting in Area (I) values being expressed in square meters or square feet depending on the setting of the Use English measurement units checkbox. Unprojected drawings use coordinate systems expressed in degrees, resulting in Area (I) values being expressed in square degrees.

Because the size of a "square degree" varies considerably based on its latitude, values of Area (I) and Length (I) will normally only have acceptable accuracy if the drawing is projected to some projection that provides reasonable accuracy for the region of interest.

Bearings

The Bearing (I) field is only accurate when the drawing is projected and only then within that part of the projection within which the accuracy of bearings is preserved. Bearings can only be as accurate as the projection of the drawing allows them to be.

To take an example, consider the case of an unprojected drawing in latitude / longitude. What is a straight line in latitude and longitude coordinates is a curved line in the 3D spherical surface of the Earth. This means that in most cases the value of the bearing will be different at different positions along the line. In cases where the value of the bearing changes along the line, Bearing (I) returns the value of the bearing near the starting location. This can be quite different from the value of the bearing near the end of the line.

To avoid such problems, project the drawing into some suitable projection that preserves angles in the area of interest before using Bearing (I).

Note that the values reported by the Bearing (I) field are ellipsoidal bearings (computed over a 3D Earth ellipsoid), while the values used by the dialog mode of visual editing and selection tools are Euclidean bearings ("flat" bearings within whatever projection is in use). Ellipsoidal and Euclidean bearings are not the same thing and should not generally be used interchangeably. Euclidean bearings are only as good as or as inaccurate as whatever projection is used, so if bearings are important it is also important to select a projection that preserves accurate angles within the area of interest. Projections must always be selected to preserve the map characteristics of interest (see the Projections Readings topic).

Performance

Showing all the intrinsic fields in a table will slow down table redisplay speed, since some of the intrinsic fields require computation. Intrinsic fields are computed on the fly whenever a table is displayed. Some fields such as Area (I) are computationally very expensive and thus could dramatically slow down performance to a level unacceptable for interactive work in the case of very large drawings when working on slower machines.

One way of avoiding an interactive slow down is to not display the intrinsic fields but only to use them within SQL queries and other relatively non-interactive processes. Even in this case, though, the fields will still be recomputed on the fly so such queries could take a very long time to run when working with large drawings.

To achieve faster performance we can use the Transform toolbar to Copy an intrinsic field such as Area (I) to a new column in the table. This requires a one-time computation. After the Copy is done, we can turn off the intrinsic field and view the new column, which will be a fixed column that is stored data like all of the other columns. The new column will not be dynamically recomputed so if there are any changes made to the areas in the drawing the new column's values will not change. In addition, the size of the table will increase as stored on disk because the new column is saved in storage and not computed as needed. Despite these minor limitations this technique is fine for use with drawings where the objects don't change but where the values reported by the intrinsic fields must be rapidly available.

Because some intrinsic fields, for example, Area (I), take a long time to compute, Manifold caches their values whenever possible. The first time we access such a column (say, by invoking the Object Fields dialog, which queries the value of each intrinsic field, even if the intrinsic fields are initially hidden), Manifold will do the necessary computations and will save the resulting values in cache. On subsequent accesses Manifold will not need to compute the intrinsic field but can simply use values already in cache.

Intrinsic Fields when Pasting Surfaces and Images

When copying a surface or an image and then pasting as a table, the Paste As dialog will offer intrinsic fields computed for each pixel in the surface or image.

For surfaces, intrinsic fields available will be:

 Center Easting (I) X coordinate of the center of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Center Latitude (I) Latitude of the center of this pixel in degrees latitude. Center Longitude (I) Longitude of the center of this pixel in degrees longitude. Center Northing (I) Y coordinate of the center of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Center X (I) X coordinate of the center of this pixel in native coordinate system units. Center Y (I) Y coordinate of the center of this pixel in native coordinate system units. Height (I) Height value. Invisible (I) 0 or 1 to indicate invisible pixels, normally used for missing height values. Latitude (I) Latitude of the lower left corner of this pixel in degrees latitude. Longitude (I) Longitude of the lower left corner of this pixel in degrees longitude. Easting (I) X coordinate of the lower left corner of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Northing (I) Y coordinate of the lower left corner of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Selection (I) Boolean: currently selected or not. Selection Mask (I) A byte giving the saved selections mask. X (I) X coordinate of the lower left corner of this pixel in native coordinate system units. X Offset (I) X position in pixel coordinates from the lower left corner. Y (I) Y coordinate of the lower left corner of this pixel in native coordinate system units. Y Offset (I) Y position in pixel coordinates from the lower left corner.

For images, intrinsic fields will be appropriate to the type of image. Many fields are the same as those available for surfaces.

 Center Easting (I) X coordinate of the center of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Center Latitude (I) Latitude of the center of this pixel in degrees latitude. Center Longitude (I) Longitude of the center of this pixel in degrees longitude. Center Northing (I) Y coordinate of the center of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Center X (I) X coordinate of the center of this pixel in native coordinate system units. Center Y (I) Y coordinate of the center of this pixel in native coordinate system units. Invisible (I) 0 or 1 to indicate invisible pixels, normally used for missing height values. Latitude (I) Latitude of the lower left corner of this pixel in degrees latitude. Longitude (I) Longitude of the lower left corner of this pixel in degrees longitude. Easting (I) X coordinate of the lower left corner of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Northing (I) Y coordinate of the lower left corner of this pixel in native coordinate system units adjusted with the values of the local scale and local offset parameters. Selection (I) Boolean: currently selected or not. Selection Mask (I) A byte giving the saved selections mask. X (I) X coordinate of the lower left corner of this pixel in native coordinate system units. X Offset (I) X position in pixel coordinates from the lower left corner. Y (I) Y coordinate of the lower left corner of this pixel in native coordinate system units. Y Offset (I) Y position in pixel coordinates from the lower left corner.

In addition there are intrinsic fields specific to images:

 Color (I) RGB color value expressed as a decimal number (the decimal equivalent to a hexidecimal color value in the form #rrggbb. Color Index (I) A color index from 0 to 255 available for palette images only. Red (I) Red channel value from 0 to 255. Green (I) Green channel value from 0 to 255. Blue (I) Blue channel value from 0 to 255. Alpha (I) Alpha channel value from 0 to 255. Intensity (I) Intensity value from 0 to 255. Hue (I) Hue value from 0 to 255. Lightness (I) Lightness value from 0 to 255. Saturation (I) Saturation value from 0 to 255.

Virtual Tables

Images and surfaces in Manifold have virtual tables that allow queries to access the image using intrinsic fields like the above. See the Virtual Tables for Images and Surfaces topic for details.

Pixel Coordinates

The X Offset (I) and Y Offset (I) values give the X and Y coordinates of the pixel in column and row pixel coordinates. If an image is 8192 pixels wide (8192 columns) and 4096 columns high (4096 rows) the X Offset (I) coordinates of the pixels will range from 0 to 8191 and the Y Offset (I) coordinates of the pixels will range from 0 to 4095. The pixel in the upper left of the image (first row, first column) will have coordinates of X Offset (I) = 0 and Y Offset (I) = 0. The pixel in the lower left corner will have coordinates of X Offset (I) = 0 and Y Offset (I) = 4095. The pixel in the lower right corner of the image will have coordinates of X Offset (I) = 8191 and Y Offset (I) = 4095.

Pixels in georegistered images can cover a large region, quite possibly several kilometers in size. The positions reported by X (I), Y (I), Longitude (I) and Latitude (I) report the location of the lower left corner of the pixel.

Tech Tip

Note that the Selection (I) intrinsic is a Boolean. It may appear as a 1 or a 0 value or Yes or No or True or False because that is the way the column is formatted for appearance. However, when used in a query, the true Boolean value of Selection (I) should be checked as True or False.

Therefore, Selection (I)] = true is a valid test in a SQL query but [Selection (I)] = 1 will not work. It is a coincidence of conversion rules that [Selection (I)] = -1 will also work.