Content of this document is proprietary work of Intergraph Corporation, or relevant third parties, and is protected by copyright law and international treaty. All rights in content or materials bearing copyright notice or other attribution of third party rights are reserved to the relevant third party. Any content or materials supplied hereunder are provided "as is", without warranty of any kind, either expressed or implied.
Content of this document is proprietary work of Intergraph Corporation, or relevant third parties, and is protected by copyright law and international treaty. All rights in content or materials bearing copyright notice or other attribution of third party rights are reserved to the relevant third party. Any content or materials supplied hereunder are provided "as is", without warranty of any kind, either expressed or implied.
Content of this document is proprietary work of Intergraph Corporation, or relevant third parties, and is protected by copyright law and international treaty. All rights in content or materials bearing copyright notice or other attribution of third party rights are reserved to the relevant third party. Any content or materials supplied hereunder are provided "as is", without warranty of any kind, either expressed or implied.
Functions that Manipulate, Calculate and Create Geometry
November, 2007
2007 Intergraph Corporation. All rights reserved. The content of this document is proprietary work of Intergraph Corporation, or relevant third parties, and is protected by copyright law and international treaty. Any use, duplication, distribution or disclosure of such, other than as specified herein, is unauthorized and in violation of applicable copyright law and international treaty. All rights in content or materials bearing copyright notice or other attribution of third party rights are reserved to the relevant third party. United States Government license rights are limited to those mandatory rights identified in DFARS 252.227-7015(b). Intergraph may make improvements and/or changes in the products and/or the programs described in this publication at any time without notice. Any content or materials supplied hereunder are provided "as is", without warranty of any kind, either expressed or implied, including, but not limited to, any implied warranties of merchantability, fitness for a particular purpose, or against infringement. In no event shall Intergraph be liable for any damages arising out of, or in connection with the downloading, viewing, use, duplication, distribution or disclosure of any content or material published by Intergraph, including but not limited to any direct, indirect, incidental, special, punitive or consequential damages, or loss or corruption of data. Some jurisdictions do not allow the exclusions or limitations set forth above, so the above may not apply to you. The exclusions or limitations shall apply in all jurisdictions to the maximum extent allowed by law.
3 2 Whats In this Tech Paper? A version 6.0 over-view of GeoMedias geometry functions used in Analysis > Functional Attributes and Analytical Merge commands. Introduction to Functional Attributes Geometry Functions Examples
3 Warehouse Connections GeoMedia allows you to view and analyze data from multiple sources. The data is dynamically transformed to the GeoWorkspace viewing document. Oracle Access MSSQL CAD Others ArcView MapInfo Warehouses Warehouses Connections Connections GeoWorkspace GeoWorkspace (.gws) (.gws) Functional attributes can be used on any data from any warehouse. Intergraph Tech Note
4 GeoMedia Operates Out of the Record Set Whats A Record Set? A virtual table loaded to local machine. All record sets originate from a warehouse via a named connection. Read-Write Connections Read-Only Connections Record sets can be graphic (viewed graphically on map) Record sets can be non-graphic (viewed only in data view) Functional Attributes can be used with ANY record set Example: Calculate the centerpoint of some ArcInfo polygons: CENTERPOINT(input.Geometry)
5 What is a GM Record set? PKey RECORD SET Graphic Attribute Non-Graphic Attributes Each of these attributes are values stored in the database Record GeoMedia Functional Geometry
5 6 What is a Functional Attribute? Dynamic attributes and/or graphics derived from custom built strings (expressions). Each row or record is processed individually and output. Automatically update as the data changes. FUNCTION OUTPUT INPUT
7 The Functional Attribute Query Intergraph Tech Note
6 8 What is a Functional Attribute? FAttr1 = RIGHT(Input.CITY_NAME, 2) RIGHT( , 2) RIGHT( , 2) RIGHT( , 2) Expression Stored in memory Read Only Function Syntax: RIGHT(text,num_chars)
9 When are expressions processed? Functions are calculated (or recalculated) when: When the query is initially added to a map or data window. When the connection is reopened. When the GeoWorkspace (.gws) file is opened. Warehouse > Connections, Reopen After applying or removing a spatial filter. When edit attributes or geometry, then only the relevant records are updated. Example: NOW() function returns current system time Resulting time value does not change until: Connection or GeoWorkspace is reopened Applying a Spatial Filter Editing attributes or geometry GeoMedia Functional Geometry
7 10 Where can functions be used in GeoMedia? Analysis > Queries Functional Attributes Analytical Merge Aggregation Edit > Attributes Update Attributes Map Display Attribute Based Symbology (ABS) Advanced tab of Style dialog Allows style properties such as size, color, etc. to be evaluated on individual basis. Map view tool tip expressions
11 From Functional Attributes Query Intergraph Tech Note
8 12 Where to create the Fun.Expressions? Create expressions here in the white space Syntax of selected function and explanation
13 From Analytical Merge Query GeoMedia Functional Geometry
9 14 From Aggregation Query
15 From Update Attributes Command Intergraph Tech Note
10 16 From Advanced Style Grid -ABS Double click
17 From Map Window Tooltip GeoMedia Functional Geometry
11 18 Building Functional Attributes Workflow
Aids to Build the Function Press <F1> for Help, then click Functional Attribute Information link, Expression Packages for list of functions. Intergraph Tech Note
12 20 Indicator of Valid Expression When Functional Attribute dialog sees correct syntax, an Output type is assigned. The Output type depends on the expression used. Setting the Format is optional.
21 The Parenthesis Open parenthesis ( requires closing ) parenthesis.. Somewhere in the expression. If in doubt, use the parenthesis. Math Rules Apply: Incorrect example for % population less than 5 yrs old: Input.AGE0+Input.AGE1_2+Input.AGE3_4/Input.Population Correct example for % population less than 5 yrs old : (Input.AGE0+Input.AGE1_2+Input.AGE3_4)/Input.Population GeoMedia Functional Geometry
13 22 Expressions can use multiple functions Single function expression examples: Population Density Input.POP / Input.SquareMiles Width (may be negative or positive) Input.x1 input.x2 Multi function expression examples: Population Density Rounded to 0 digits ROUND(Input.POP / Input.SquareMiles),0) Absolute value for width ABS(Input.x1-input.x2) Distance between XY coordinate values SQRT(SQR(input.x1 input.x2)+ SQR(input.y1 input.y2))
23 Types of Functions Broadly speaking, functions act as: Scalar (1:1) One record in, one record out. Typically same number of records in the resulting query as the source table. Expanding (1:Many) One record in, many records out. Typically more records in the resulting query than the source table. Aggregating (Many:1) Many Records in, one record out. Typically fewer records in the resulting query than the source table. Why say typically? Some expressions are hybrid in that expression string may use multiple functions that fall into more than one category. The output record set type (scalar, expanded, or aggregated) depends on the syntax of the expression string. The outside function is evaluated last so, it usually controls the result. Intergraph Tech Note
14 24 Example Scalar Function Scalar function has a 1:1 relation between input and output records.
25 Example Expansion Function Expansion function has 1:Many relation between input and output records. GeoMedia Functional Geometry
15 26 Example Aggregating Function Aggregating function has Many:1 relation between input and output records.
27 Calculating Length, Area and Coordinate Attributes Functional Attributes can calculate attributes from input geometry. Area Length Coordinates Projected Geographic These geometry calculations are: Scalar functions Based on projection of the feature class in the warehouse. Can use Warehouse > Feature Class Definition to review the coordinate system of storage. Intergraph Tech Note
16 28 Feature Class Definition Dialogs Use Warehouse > Feature Class Definition to review coordinate system
17 30 Unexpected Input Geometry If you input a geometry that is not expected: The calculation may return 0 as the resulting values. For Example: If you input point geometries into an AREA function then all of the calculated values for area will be 0. The calculation may return NULL values. For Example: If you input lines into X function, then all of the X calculated values will be NULL. Other times you may get an odd error message: For example: If you input lines into the ORIENATION function then the following message may appear:
31 Syntax for Geometry Attribute Calculations Intergraph Tech Note
18 32 Measurement and Unit Types
33 AREA Function Form: AREA(Input.GEOMETRY,MeasType,UnitofMeasure) Both MeasType and UnitofMeasure variables can be selected from the category: Constants Where MeasType can be either: ProjectedMeas Measures along plane of map projection) TrueMeas Measures along curvature of earth based on datum) UnitofMeasure can be any area unit Examples: AREA(Input.GEOMETRY,TrueMeas,SquareMeter) AREA(Input.Intersection_Geom,ProjectedMeas,acre) GeoMedia Functional Geometry
19 34 Example Using Area Function
35 Variances of Input Geometry Names Geometry names can be selected from the Attributes list box along the right side of the dialog. Intergraph Tech Note
20 36 LENGTH Function Form: LENGTH(Input.GEOMETRY,MeasType,UnitofMeasure) Both MeasType and UnitofMeasure variables can be selected from the category: Constants Where MeasType can be either: ProjectedMeas Measures along plane of map projection) TrueMeas Measures along curvature of earth based on datum) UnitofMeasure can be any Length unit Examples: LENGTH(Input.GEOMETRY,TrueMeas,SurveyFoot) LENGTH(Input.Intersection_Geom,ProjectedMeas,Meter)
37 X, Y Functions Geographic Coordinates Use TrueMeas Longitude: X(Input.Geometry, TrueMeas, Degree) Latitude: Y(Input.Geometry, TrueMeas, Degree) Projected Coordinates Use ProjectedMeas Projected X (easting) X(Input.Geometry, ProjectedMeas, meter) Projected Y (northing) Y(Input.Geometry, ProjectedMeas, SurveyFoot) GeoMedia Functional Geometry
21 38 ANGLE function Syntax ANGLE(Geometry, MeasType, UnitOfMeasure) Input geometry: Point or line segment (2 point line) geometries If the input geometry is not point or 2-point line, then the value of the angle will be NULL. Output: Double Examples: ANGLE(input.geometry,truemeas, degree) Returns angles in degrees measured from true north. ANGLE(input.geometry,projectedmeas,degree) Returns angles in degrees measured from projected north. MAX(ANGLE(SEGEMENTS(input.geometry),truemeas,degree)) Returns the max angle of every line where the input.geometry is linear. This function would work even on multi-segment polylines and collections.
39 Basis for Angle Measurements 0 0 0 90 90 90 180 180 180 270 -90 270 -45 +45 Negative Orientation (90< Placed at angle <270) Placed at angle Differences between Placed at Angle, ANGLE() and ORIENTATION() Example: If point placed at 180 deg., then function: ANGLE(input.geometry) = 270 ORIENTATION(input.geometry) = -90 Intergraph Tech Note
22 40 Comparisons of Angle Measurements Symbol used: Upright arrow Actual points placed in GMPro with labels
41 Functional Geometry, An Attribute Column Graphics in the GeoWorkspace are a form of cached attributes. Many functions in FA use Geometry as input to return NEW GEOMETRY! Example: HOLES(input.geometry) Returns the holes of the input feature class or query as area geometries. User defined FA geometry attributes are stored in the output query table along with the original geometry and attributes. GeoMedia Functional Geometry
23 One Feature/Query, Multiple Geometries When FA adds the query to the legend, it will only show the functional geometry. Example: Holes converted to areas using HOLES(geometry) function. Using Legend > Add Legend Entries to Add the FA query to the map will: Add both the originating geometry(s) and the new FA geometry. These entries can be stylized and/or deleted from the legend independently. Attribute Selection can be used to unselect undesirable attributes, including old geometry. Commands that allow attribute selection: Analysis > Attribute Selection Warehouse > Output to Feature Classes Analysis > Join
43 CENTERPOINT Example of Multi-Geometries Intergraph Tech Note
24 44 Multiple Geometries and the Map Legend
45 Multiple Geometries (Cont) To remove unwanted geometries, use Analysis>Select Attributes command or Output to feature class command and select only the required attributes. Primary Geometry Secondary Geometry of the query BUT Primary geometry of States feature class To see all geometries, use add legend entries with the new functional attribute query. GeoMedia Functional Geometry
25 46 Remove Undesirable Geometry Using Attribute Selection
47 Remove Undesirable Geometry Using Output to Feature Classes Warehouse > Output to Feature Classes Intergraph Tech Note
26 48 Tips Cut and Paste is your friend. Start notepad and cut / paste between the Functional Attributes dialog and notepad as needed. A functional expression can use output from previous expressions. Output from an expression is prefixed as Output.Function_Name Output from previous expressions can be used in new functions: If already have a function to calculate SQ_Meters then it can be used when adding another function for the same query. Output.SQ_Meters / Perimeter(Input.geometry,TrueMeas,Meter) As opposed to: AREA(Input.geometry,TrueMeas,SquareMeter) / Perimeter(Input.geometry,TrueMeas,Meter)
49 ENDPOINT and STARTPOINT Functions Endpoint(input.geometry) Startpoint(input.geomety) Input geometry must be of type line. Could find start point for an segments of an area feature. STARTPOINT(SEGMENTS(input.geometry)) Find the First point (in record set) for an area feature. STARTPOINT(FIRST(SEGMENTS(input.geometry))) GeoMedia Functional Geometry
27 50 Hint: Name the Attribute Appropriately
51 FILTERAREAL Function FILTERAREAL(input.geometry) Returns any area geometries from the input geometry. Useful for returning Areas from Compound (spatial any) geometry. Example: FILTERAREAL(input.gdo_geometry) Similar Functions: FilterLinear FilterPoint Can use Output to Feature Class or Attribute Selection to get rid of any undesirable secondary geometries. Intergraph Tech Note
28 52 POINTS Function POINTS(input.geometry) Returns the vertices of the input geometry as point geometry. WARNING! This is an expansion function and explode the size of the data very quickly. If a single line has 100 vertices, the resulting query will have 100 records for the points. Each new record will have all of the attributes of the originating line.
53 CREATEPOLYLINE Function Creates lines (polylines) from points. The command can be used in two different methods depending on the input data. Aggregation Mode: Many:1 CREATEPOLYLINE(input.geometry,orderby) Analytical Merge command: Merge Points based on Route Number or Survey Number CREATEPOLYLINE(input.geometry,Station_Number) Scalar Mode: 1:1 CREATEPOLYLINE(geometry1,geometry2,geometry3) Example: Geocoded coordinates query that contains multiple geometries. GeoMedia Functional Geometry
29 54 Merging Points to Create Lines Analysis > Analytical Merge. GeoCode points can be merged to create polyline geometries. The point order can be expressed as part of the CREATEPOLYLINE function. Example: CREATEPOLYLINE(input.point,DATE) If no sort order is given, then the points are connected in the record set order. Record set order may result in odd results at times. Example: REVERSE(CREATEPOLYLINE(input.geometry))
55 Merging Points to Create Lines Workflow Intergraph Tech Note
30 56 Creating Lines from x1,y1 to x2,y2 Analysis > GeoCode Coordinates Input source table into GeoCode Coordinates and Geocode first (beginning) set of coordinates. Geocode of Geocode query(s): Input resulting Geocode Coordinates query into GeoCode Coordinates and geocode second coordinate pairs. Repeat as needed. Input resulting query into Analysis > Functional Attributes Create Function to Merge the points for lines. Example: CreatePolyline(GeoCodeCoordpoint,GeoCodeCoordpoint1)
57 Drawing 2 Point Lines Workflow GeoMedia Functional Geometry
31 58 CREATEPOLYLINE Interesting Uses: Getting rid of breaks in unconnected linear geometry collections: CREATEPOLYLINE(Points(input.geometry),ID) The ID here is Orderby and is option. If not given then the order is record set order.
59 MOVE Function MOVE(Geometry, DeltaX, DeltaY, DeltaZ, RefSpace) Delta values x,y,z measured in meters. Example: MOVE(Input.Geometry,1000,1000,0,TrueMeas) Question? Does this create a new geometry? Yes! A new functional geometry. The originating geometry is not moved. The functional geometry will move if values (delta x, y and z) change! Example: MOVE(input.geometry1,input.gps_x,input.gps_y,0,Truemeas) Interesting combination: The following could take the input point geometry then draw a line to the given delta X,delta Y CREATEPOLYLINE(input.geometry,MOVE(1000,1000,0,ProjectedMeas)) Intergraph Tech Note
32 60 GEOMETRIES Function GEOMETRIES(input.geometry) Expansion (1:Many) Returns individual geometries from a geometry collection. Operates similar to POINTS and SEGMENTS Functions.
61 GEOMETERIES, Before and After GeoMedia Functional Geometry
33 62 MERGE Function MERGE (input.geometry) This function is Aggregating (Many:1) so it is seldom used in Analysis > Functional Attributes. Exception: MERGE(SEGMENTS(Geometry)) Segments function creates from the area geometry linear lines from it's boundary+holes and the merge merge all of them back to the linear geometry that represents original boundary in the linear form. CREATEPOLYLINE(POINTS(Input.Geometry)) Mainly used with Analysis > Analytical Merge
63 COMPRESS Function COMPRESS(geometry) Does not alter geometry display. Attempts to simplify geometry to its simplest form by rewriting nested or sequenced geometries. Useful to simplify data originating from CAD connections that contained complexed areas/shapes. Input geometry of any type Outputs Simplified Geometry Example: COMPRESS(input.geometry) Intergraph Tech Note
34 64 COMPRESS, Before and After
65 DENSIFY Function DENSIFY(Geometry, MaxDistance, MaxSize) MaxDistance: The maximal distance between vertices along a sequence of vertices, in meters. MaxSize: The densification process stops when the size of the blob reaches MaxSize, which is measured in bytes. This parameter is optional; if missing, 1000 vertices is used. In this case MaxSize will be equal to 24000 bytes Return Type: The same as the input geometry. GeoMedia Functional Geometry
35 66 DOTDENSITY Function DOTDENSITY(Geometry, NumberOfPoints) The input geometry must be of type area. The number of points must be integer value. Example: DOTDENSITY(Input.Geometry, INT(Input.tract_pop100/6)) Take the input area geometry and place points in each polygon which are equal to the tract_pop divided by 6. In this case the tract_pop is double so must be converted to integer first.
67 FORMATMEAS Function FORMATMEAS(Value, FormatType, UnitID, Precision) Output is type: TEXT Value: The value to be formatted. FormatType: Formatted unit category. Intergraph Tech Note
36 68 FORMATMEAS to Convert Radian to DD:MM:SS To calculate longitude in DD:MM:SS The following example first calculates the X value in Radians and then formats radians to the desired DD:MM:SS format with an expressed precision of 3 decimal seconds. FORMATMEAS(X(Input.Geometry, TrueMeas, Radian), FormatType.Angle, DegreesMinutesSeconds, 3) Note: When using the X or Y functions with the Unit of Measure set to DegreesMinutesSeconds the output will be seconds expressed to double precision. Example: X(input.geometry,TrueMeas,DegreesMinutesSeconds) outputs seconds.nnnnnn
69 EXTERIOR and HOLES Functions Exterior(input.geometry) Returns the exterior of the input area geometry (holes are discarded). Holes(input.geometry) Returns the holes of the input area geometry (exterior boundary lines are discarded). GeoMedia Functional Geometry
37 70 GRAPHICSTEXTBOX Function GRAPHICSTEXTBOX(GraphicsText, MapScale, FontName, FontSize, FontBold, FontItalic) Places a box around text. Examples: GRAPHICSTEXTBOX(Input.Offset,4000000) GRAPHICSTEXTBOX(input.geometry,24000,Times,10)
71 GRAPHICSTEXTSTRING Function Loads the text string as an attribute of the text record. GraphicsTextString(input.geometry) Intergraph Tech Note
38 72 IMAGEFILENAME and IMAGEPOLYGON Functions ImageFileName: Loads the image file name as an attribute of the image record. Input: geometry of image feature class. ImagePolygon: Creates a shape representing the foot print of the images. See also: Analysis > Image Footprints command.
73 ORIENTATION and ORIGIN Functions Orientation: Returns the angle in degrees of input text or point orientated geometries. Origin: Returns the origin point of input text or point. GeoMedia Functional Geometry
39 74 REVERSE Function This function returns the original geometry with reversed vertex order. This is a scalar function. Syntax: REVERSE(Geometry) Geometry: must be type Linear, Areal, or AnySpatial. If linear, reversed linear geometry is returned. If area, reversed areal geometry is returned If collection, reversed collection of reversed geometry is returned. Individual geometry is reversed, and the items in the collection are also reordered, from last to first, so that overall vertex sequence is retained.
75 SEGMENTS Function Expands line segments of geometries to individual linear geometries. This is an expansion function. Syntax: SEGMENTS(Geometry) Input Geometry: Linear, Areal, or AnySpatial. Intergraph Tech Note
40 76 SETZ Function Sets the Z value of all vertices of the input geometry. This is a scalar function. Syntax: SETZ(Geometry, NewZ)
77 SPIN Function This function spins a point or text by a relative amount in degrees. Syntax: SPIN(Geometry, Angle) Geometry: Input point or text geometry that will be spun. Return Type: The same type as the input geometry. GeoMedia Functional Geometry
41 78 UNIT Function This function converts a value from one unit of measure to another unit of measure, for example, feet to meters. Syntax: UNIT(Value, UnitType, UnitIDFrom, UnitIDTo) Value: The value to convert. UnitType: The measurement category (lookup in Category Constants. Angle Distance Area Example: Using Unit to convert from inches of rainfall to CM Rainfall. UNIT(Input.ANNULRAIN,UnitType.Distance,Inch,centimeter)
79 Note on Unit The UNIT function cannot format to or from Degrees:Minutes:Seconds as output from Unit function is restricted to type Double. An alternative would be to convert or calculate radian values and then use the FormatMeas function. The same holds true for the format of dd.mmssss. FORMATMEAS(X(Input.Geometry, TrueMeas, Radian), FormatType.Angle, DegreesMinutesSeconds, 3) Intergraph Tech Note
42 80 Additional Information: Press <F1> key while viewing Functional Attributes, Expression dialog. Look for Working With Information Expression Packages. Web Based Help: http://support.intergraph.com/TechNotes/functions.asp Informal How to Videos: http://support.intergraph.com/Geospatial/knowledgebase/HowTos.asp Contact your local Intergraph Support http://www.intergraph.com/support/
GeoMedia Functional Geometry 43 Whats In This Lab Session? The goal of this session is to introduce you to the concept of functional expressions, and then center our discussions on functional expressions that can be used with graphic geometry in GeoMedia. Major session topics include: Introductory Concepts What is functional attributes? Where can they be used? What are the major kinds of functions? Scalar (1:1) Expansion (1:Many) Aggregating (Many:1) Discussion of Geometry Functions Functions that calculate attributes from geometry Example calculations: AREA LENGTH X,Y,Z Functions that create new geometry Examples: Creating CENTERPOINTS of area or linear geometries Finding STARTPOINTS or ENDPOINTS of lines Drawing lines using points (connect the dots) Introduction: A function, in the case of GeoMedia, can be thought of as a named program or subroutine that performs a specific task. GeoMedia comes delivered with over 100 predefined, named functions, each like a subroutine, takes input, acts upon the input, and produces output. Each function has requirements on the type of input and results in predictable, standard output of a particular data type. The square root (SQRT) function for example expects a number as input and results in a standard expected output that is a number (double data type) representing the square root of the input value. The function acts according to the value defined in the expression string. For example: The following expression string, SQRT(4) would return 2 The output from the expression, SQRT(Input.population) would change based on the input variable of population. The functional query(s) are thus constantly updated as the data changes. The query(s) are stored in the GeoWorkspace and can be displayed when needed and do not require reconstruction. Just view your data as it is. Intergraph Tech Note
44 GeoMedia Functional Geometry 45 Lab Introduction The bulk of the data used for the labs in this session are located in C:\GM341. This folder should have been automatically created and populated by unzipping the self extracting zip provided in the class data. This step may have already been done for you. Consult your instructor. Use a Windows Explorer window to navigate to C:\GM341 and note the available folder listings. Lab Objectives: The objectives of this lesson are to demonstrate how to do the following: Use Functional Attributes to perform geometry calculations that produce numeric or text attributes. Use Functional Attributes to create new geometry in scalar (1:1) mode. Use Functional Attributes to create new geometry that is expansive (1:Many) mode. Integrate point geometry output from Geocode Coordinates command to create linear data in both aggregating mode (Analytical Merge) and scalar mode (using Functional Attributes). Orientation to Data: Opening an Existing GeoWorkspace 1. Use Windows Explorer to navigate to C:\GM341. This is the location of the session data. 2. Open the folder C:\GM341\GeoWorksapces. 3. Double-click on the file, GM341.gws. Note: Depending on system settings, the .gws file extension may not appear. The GM341.gws file opens and displays graphical data stored in an example read-only ArcView shape file connection. 4. Optionally, you can click and drag the sides or corners of the GeoMedia Application or map windows (outer edge) to resize as desired. 5. Select Warehouse > Connections. The connections dialog appears (see graphic below). 6. Notice there are two connections: one is the read-only ArcView data, the other is a read-write connection to some example county level data stored in an Access (.mdb) warehouse. Intergraph Tech Note
46
7. After reviewing the connections, select Close to exit the connections dialog. 8. Use the Select Tool to double-click on one of the Census_Tract geometries in the map view. The Census_Tract Properties dialog appears showing the attributes of the ArcView data. 9. Notice how the attribute values are all read-only. Notice also there is information about population yet no information for population density. GeoMedia queries support using read-only data as well as read-write. We can then use Functional Analysis to calculate desired new attribute(s). In this case we can use the shape file geometries to calculate AREA (square miles) to use for the population density (people / square mile).
10. After review the Census_Tact properties, select Close. Calculating Scalar Attributes from Geometry Using AREA Function The AREA function allows you to calculate area based on the selected geometry. The function is scalar in that for each record that is processed (in this case 63 census tracts), there will be one record output. The format for the AREA function is the similar to functions for X, Y, Z, LENGTH, PERIMETER, and ANGLE. Accessing Functional Attributes 1. Select Analysis > Functional Attributes (see graphic below). GeoMedia Functional Geometry 47
The Functional Attributes dialog appears. 2. Click in the Add functional attributes for field drop down list, expand the census tracts connection, and select Census_Tracts.
Census_Tracts is now listed in the Add functional attributes for field. 3. Click on the New button. The Functional Attribute dialog appears. The Functional Attribute dialog allows an expression to be created that can be used to calculate new attribute information that can be named on the dialog. Reviewing Help 1. With the Functional Attribute dialog visible, press the <F1> key. The GeoMedia Help Menu appears. 2. On the right side of the menu, select the link for see Functional Attribute Information. 3. Click on Expression Function Packages Lists of function links are displayed. 4. Try clicking on AREA listed in the Geometry section. 5. Click on the Example button listed near the top (see graphic below). Intergraph Tech Note
48
6. After reviewing the example, close (X) the Help dialog. Building the Expression 1. Click in the Functional attribute name field, and type Square_Miles.
2. In the Categories section (lower left), click on the Geometry category. (see graphic below)
Functions that use Geometry are displayed in the Functions section. 3. In the Functions section, double click on AREA.
AREA() is added to the expression field. 4. Notice that the format for AREA is displayed at the bottom of the dialog (See graphic below). GeoMedia Functional Geometry 49
So based on the format, we need to supply the geometry, measurement type, unit of measure. 5. In the Attributes section, double-click on Input.Geometry to define the geometry field to use for calculating area.
Input.Geometry is added to the expression string. Input.Geometry is a typical default geometry attribute name from but be mindful that geometry names can vary and there can be multiple geometries to choose from. If in doubt, you can highlight any attribute to review the brief data information listed at the bottom of the dialog. 6. Type a comma , character (no quotes). 7. In the Categories section, highlight the Constants category. 8. Scroll through the Constants and double-click on TrueMeas.
TrueMeas is added to the expression string. Note: Measurement type will always be either TrueMeas or ProjectedMeas, which are both listed in the Constants category. 9. Type a comma , character. 10. Scroll down the list of Constants, and double click on SquareMile. Note: It is up to you as the creator of the expression, to select an appropriate unit of measurement (UOM). The dialog makes not error check to see if the UOM is appropriate for the function. Intergraph Tech Note
50
SquareMile is added the Expression string. The expression now looks like:
11. Select the Add button.
The Square_Miles attribute/expression is saved and the Functional Attribute dialog is cleared and ready to create more functional attribute/expressions. Calculating Population Density: The output of one functional calculation can be used in other functional expressions. In this case we can use the output Square_Miles calculation to calculate population density. 1. Key in Pop_Density into the Functional attribute name field.
2. In the Attributes section (lower right), double-click on Input.Pop_Total (see graphic below). GeoMedia Functional Geometry 51
Input.Pop_Total is listed in the Expression field. 3. Click on the / (divisor) operator.
4. In the Attributes section (lower right), double-click on Output.Square_Miles. The expression string now reads: Input.Pop_Total/Output.Square_Miles (see graphic below).
5. Select Add. The functional attribute is added to the list of available attributes and the dialog is cleared for further calculations. 6. Select Close. The main Functional Attributes dialog is redisplayed. 7. Change the output Query name to FA of Census_Tracts (see graphic below). Intergraph Tech Note
52
8. Click OK to run the new query. The resulting query is displayed in both a data and map view. 9. Use the Horizontal scroll to view the right side of the data view (see graphic below).
10. Notice how that in addition to the original shapefile attributes, we now have newly calculated functional attributes. The values here are dynamic and will reflect the latest results of the source data changes each time the GeoWorkspace (.gws) file is opened or when the connection is reopened using the Warehouses > Connections, Reopen command. 11. Close (X) the data window after reviewing the data. The map view is active with the query listed at the top of the map legend. 12. Once again use the Select Tool to double-click on one of the census areas. The Attribute Properties for FA of Census_Tracts is displayed. GeoMedia Functional Geometry 53 13. Notice how there seems to be too much precision expressed for the population density GeoWorkspace queries can be managed using Analysis Queries command. Review & Edit of Existing Queries 1. Select Analysis > Queries command.
The Queries dialog appears. 2. Select the Properties button for the FA of Census_Tracts query. The Queries Properties for the Census_Tracts query appears. 3. In the Output functional attributes section, double-click on Pop_Density.
The Functional Attribute dialog appears. 4. Click and drag over the expression string so the entire string is highlighted.
5. With the expression string highlighted, right-click in the expression field and select Cut.
Intergraph Tech Note
54
The Expression is cut into the paste buffer. 6. Click on the Math and Trig Category.
Functions associated with math and trig are listed in the Functions section. 7. Scroll through the list of Functions and locate ROUND. Double-click ROUND to add it to the Expression field.
8. Notice at the bottom of the dialog the syntax for ROUND calls for a number. 9. Right-click in the Expression field and select Paste. The Pop_Density function is pasted into the ROUND() function. 10. Key in a comma , character and enter a value of 0. (compare your syntax to the line below). GeoMedia Functional Geometry 55 The function should now read: ROUND(Input.Pop_Total/Output.Square_Miles,0) which will round the Pop_Density calculation to 0 digits.
11. Click OK on the Functional Attribute dialog. The Query Properties dialog is redisplayed. 12. Click OK on the Query Properties dialog and Close the Queries dialog. 13. Once again use the Select Tool to double-click on one of the Census Tracts to review the Population Density calculation. Tool Tip Expressions: The functional attribute we just built in the functional attributes command is stored and displayed as query. The same function could have been built for use as Map Window Tool Tip. In this case we will not rebuild the function but merely pick it from a list of available attributes. 1. Right-click on the legend entry for Census_Tracts and select Map Window Tooltip > Attributes > to review the options. (See graphic below).
2. Click on the Expression option (see graphic below). Intergraph Tech Note
56
The Map Window Tooltip dialog appears. 3. We are not going to do this but note how this dialog could be used to build functional attributes that can be used for tool tips. We are NOT going to build an expression here, BUT IF you were to build the same function from scratch it might look like: ROUND(Input.Pop_Total/AREA(Input.Geometry,TrueMeas,SquareMile)) The resulting data type here however must result in a TEXT data type so you can use the CAST() function to easily change the data type to TEXT. CAST(ROUND(Input.Pop_Total/AREA(Input.Geometry,TrueMeas,SquareMile)),TEXT) 4. Click Cancel on the dialog. 5. Right-click on the FA of Census_Tracts legend entry and select Map Window Tooltip > Attributes> Pop_Density (see graphic below).
6. Move the on screen cursor over the census tracts. After a slight hesitation notice the calculated attribute display showing the population density as tool tip. GeoMedia Functional Geometry 57 Concept! Map Window tooltips support both the selection of attributes and custom expressions to display the tool tip. The tool tip setting is set and stored as part of the legend entry. You could use the Legend > Name Legend command to store various named legends that contain custom tool tips. These named legends could then be managed and displayed as needed using the Legend > Legends command. Tool tips are NOT stored as part of the style. Introduction to Functions that Create Geometry In GeoMedia, you can think of the Geometry as an attribute column in a virtual data table. In this section we will find that geometry manipulating functions output the updated geometry to new attribute column. So the resulting functional query will have multiple geometries. For example, if you have a point feature class called WELLS with Depth information, then you could use the SETZ(Input.Geometry,input.Depth) to set the Z value of the point geometries. The resulting functional geometry is dynamically calculated and added to the resulting query table such that there will be 2 geometry columns, the original input geometry and a new functional geometry with Z values dynamically set by the Depth attribute. Functions that create new geometry can be scalar or expansive. CENTERPOINT Function, a Scalar Example The CENTERPOINT function can be used to calculate the centerpoint of any input geometry other than text or image geometry types. The function is scalar (1 record in : 1 record out). Other examples of geometry generating, scalar functions with syntax similar to CENTERPOINT include: STARTPOINT, ENDPOINT, ORIGIN, EXTERIOR and HOLES. The Census Tracts are still visible on the map view. We will calculate centerpoints for the census tract areas. 1. Select Analysis > Functional Attributes. The Functional Attributes dialog appears. 2. Click in the Add functional attributes for field drop down list, expand the census tracts connection, and select Census_Tracts
Census_Tracts is now listed in the Add functional attributes for field. 3. Click on the New button. The Functional Attribute dialog appears. The Functional Attribute dialog allows an expression to be created that can be used to calculate new attribute information which can be new geometry. Intergraph Tech Note
58 4. Click in the Functional attribute name field, and type Geom_Centerpoints.
5. In the Categories section (lower left), click on the Geometry category. Functions that use Geometry are displayed in the Functions section. 6. In the list of Functions, double-click CENTERPOINT.
CENTERPOINT() is added to the expression field. Notice that the format for CENTERPOINT is displayed at the bottom of the dialog. So based on the format, we need only supply the geometry. 7. In the Attributes section, double-click on Input.Geometry to define the geometry field to use for calculating the centerpoint.
Input.Geometry is added to the expression string.
8. Click on the Add button. The functional attribute is added to the list of Attributes and the dialog is cleared for new input. 9. Select Close. 10. Change the output Query name to Centerpoints of Census_Tracts. 11. Notice how the output geometry will be point (see graphic below). GeoMedia Functional Geometry 59
12. Click OK to view the results. Reviewing the Results 1. Close (X) the data window if it appears. The centerpoints are displayed in the map view. 2. Notice how there is exactly one output point for each area (a classic 1:1 Scalar Function). 3. Use the Select Tool to double-click on a point. The Properties for Census_Tracts appears, showing that the Functional Attributes command always outputs the original attributes to the resulting query in addition to any calculated attributes, even if the calculated attributes are geometry. 4. Close the Properties dialog. 5. Press and hold the <Ctrl> key and click on each of the map legend entries. All of the legend entries are now highlighted. 6. Press <Delete> key and select Yes to delete the selected legend entries. The legend entries are deleted from the map. 7. Select Legend > Add Legend Entries
The Add Legend Entries dialog appears. 8. Expand the Queries and select Centerpoints of Census_Tracts.
9. Click OK to add the query back to the legend. Intergraph Tech Note
60 10. Notice how there are two legend entries.
Concept! When new geometry is created functionally, it is added to the existing table as additional geometry. The originating geometry is still present. Legend > Add Legend Entries, always adds all geometry found in the feature class or query. Query commands that generate new geometry always add the highest order geometry in the list of output attributes (the primary geometry for the query). Getting Rid of Unwanted Geometry The Analysis > Attribute Selection command can be used to remove undesirable attributes including geometry. 1. <Delete> all the legend entries from the map view. 2. Select Analysis > Attribute Selection The Attribute Selection dialog appears. 3. Click in the Select Attributes from field, to expand Queries and select Centerpoints of Census_Tracts.
Attributes for the Centerpoints of Census_Tracts appear in the Attributes list. 4. Uncheck the Geometry attribute (see graphic below).
GeoMedia Functional Geometry 61
5. Uncheck the option to Display in data window.
6. Click OK to review the results in the map view. Concept! The Attribute Selection command can be used to remove old undesirable geometries. A similar work flow can be done using Joins as well as Warehouse > Output to Feature Classes which can be used to copy the query to a new or existing Access, MS SQL or Oracle warehouse table. Replacing the Map Legend: 1. Select Legend > Legends. The Legends dialog appears. 2. Highlight the named legend, Downtown Base Map.
3. Select Replace and Yes to replace the current map legend now. Intergraph Tech Note
62 4. Select Close on the Legends dialog. Parcels for 2 square miles of downtown Huntsville, Alabama are displayed in the map view. SEGMENTS, an Expansion Function: Several of the Geometry functions are expansion functions where 1 record can result in many output records. As with other functions the source attributes are available in each output record. Some care should be taken when working with expansion type functions as they can quickly balloon a small set of data to a quite large set of data. In the following example, we generate segment geometries from the parcel area geometries. Generating the segments for our parcels should pose no problems but the resulting query will still be large considering that map legend tells us that there are 3054 parcel records. So if the average parcel has 5 segments, then the resulting record set will have ~15K records. If the data were larger then you might seek alternate solutions to reduce the number of parcels to be processed using tools such as Spatial Filtering, Attribute Queries or Spatial Queries. Building the SEGMENTS Expression 1. Optionally zoom in and inspect the parcels and note that they are indeed Area geometries. 2. Select Analysis > Functional Attributes. The Functional Attributes dialog appears. 3. Click in the Add functional attributes for drop-down list, expand the Madco connection and select Parcels in the list (see graphic below).
4. Click on the New button. The Functional Attribute dialog appears. 5. Key in Geom_Segments in the Functional attribute name field.
6. Select the Geometry Category. GeoMedia Functional Geometry 63 7. Scroll through the list of Functions and double-click, SEGMENTS. SEGMENTS() is added to the Expression field. 8. Double-click Input.Geometry in the list of Attributes.
9. Click Add The new Geom_Segments functional geometry is added to the list of Attributes. 10. Click Close. The Functional Attributes dialog is redisplayed. 11. Name the ouput Query name as FA Parcel Segments
12. Uncheck the option to Display in data window.
13. Click OK to display the FA Parcel Segments query in the map view. 14. Right-click on the map legend and select Fit Legend (see graphic below). Intergraph Tech Note
64
The map legend is resized so all of the legend entries are visible. 15. Compare the count of feature records between the Parcels feature class and the FA Parcel Segments. Notice how the expansion function SEGMENTS expanded the parcels table in the output query. 16. Use the Select Tool to double-click on one of the parcel boundary segments. The Properties for FA Parcel Segments dialog appears showing how the original parcel attributes are available for each segment. If the parcel shares an edge with another parcel then there will be 2 parcel segments, each with its own set of attributes. 17. Close the Properties dialog. Workflows for Creating Lines and Areas CREATEPOLYLINE in Analytical Merge (An Aggregating Example) Multiple Records per Line If you have a data table that has multiple records containing XY coordinates where each coordinate represent a point in a particular line then you can perform a 2 step process to generate the lines (or areas). Step1: Geocode Coordinates to create point geometries GeoMedia Functional Geometry 65 Step2: Analytical Merge of the point geometries with the CREATEPOLYLINE or CREATEPOLYGON functions. Reviewing the Data 1. <Delete> all the features from the map legend. 2. Select Window > New Data Window. The New Data Window dialog appears. 3. Expand the Madco connection and double-click, Log_Dat.
The data view for the Log_dat displays (see graphic below).
These are records that represent point locations along a highway. In this case we want to draw the highway line based on the Latitude and Longitude coordinate values. You can think of the data as representing the graphics in way similar to the following graphic:
Intergraph Tech Note
66
We will begin by using the Geocode Coordinates command to place the records as points in the map view. 4. Close (X) the Data Window. Geocoding Coordinates Geocode Coordinates queries allow you to create new point geometries based on projected or geographic coordinate values. The results are dynamic so if the source warehouse changes, then so will the points. For example if road data is added to the log_dat table then the points will update. 1. Select Analysis > Geocode Coordinates
The Geocode Coordinates dialog appears. 2. Click in the Geocode attributes in drop-down list; expand the Madco connection and select log_dat (see graphic below).
The Coordinate System button can be used to set the coordinate system, datum and unit of measurement for the coordinate attributes. In our case, the coordinates are Geographic, decimal degrees, in WGS84 datum. 3. Select the Coordinate System button. GeoMedia Functional Geometry 67 The Coordinate System Properties dialog appears. The dialog is organized by a series of tabs across the top. 4. Click on the Units and Formats tab. 5. Scroll through the list of Default units and precision Types and highlight Geographic. 6. Ensure that the Unit is set to deg (see graphic below).
7. Click OK on the Coordinate System Properties. The Geocode Coordinates dialog is redisplayed. 8. Select Latitude as the Latitude. 9. Select Longitude as the Longitide. 10. Change the output Query name to: Q1 Geocoded Route Points (see graphic below). Intergraph Tech Note
68
11. Check the option to display the points in the map window. 12. Click OK to Geocode the route point locations. Note: if the coordinate values were suspect or problematic, you could review the resulting Geocode query in a data view to inspect a newly created column called Geocode_Status. If for some reason the point could not be placed then this field will record the problem, thus you could then sort on the column or run attribute queries to locate the problem coordinate records. Using Analytical Merge to Create Lines from Points The Analytical Merge command can be used to group the points into groups based on attributes or spatial relation of touching. As the groups are created, you can perform summarized calculations of the groupings Max(logmile), Min(logmile) etc... for each group. In our case we can use the Analytical Merge command to group the route points based on the Route Name and draw lines using the point geometries. 1. Select Analysis > Analytical Merge. GeoMedia Functional Geometry 69
The Analytical Merge dialog appears. 2. Click in the Merge features in drop-down list; expand Queries, and select the Q1 Geocoded Route Points query (see graphic below).
3. Enable the By Attribute option for the Merge criteria. 4. Scroll though the list of Attributes and check , Route
Intergraph Tech Note
70 5. In the Output functional attributes section, highlight the default output geometry, CoordGeocodePoint (which will be a merge of the route points by the route name) and then select Delete. (See graphic below).
6. Select the New button. The Functional Attributes dialog appears. 7. Key in Geometry as the Functional attribute name (see graphic below). 8. In the Categories section (lower left), click on Geometry. Geometry Functions are displayed in the center section. 9. Locate and double-click on CREATEPOLYLINE from the list of Functions. CREATEPOLYLINE() is added to the Expression field. 10. Take note of the format information at the bottom of the dialog.
11. In this case we will use the CREATEPOLYLINE(Input.Geometry,OrderBy) format. The OrderBy is optional but useful to control the order in which the line is drawn between the points. If you do not give the OrderBy (a number value), then the software will connect the points in the Record Set Order. This can lead to unexpected results at times as the record set order cannot be guaranteed to be in the same order as you might expect. Note: If OrderBy is not given and you find the lines are drawn backwards, then you could incorporate the REVERSE function as part of the CREATEPOLYLINE function. REVERSE(CREATEPOLYLINE(Input.CoordGeocodePoint)) 12. In the Attributes section (lower right), locate and double-click the Input.CoordGeocodePoint. The geometry attribute Input.CoordGeocodePoint is added to the expression so that it now appears as: CREATEPOLYLINE(Input.CoordGeocodePoint) We will use the LogMile attribute as the Orderby. 13. Key-in a comma , character. 14. In the Attributes section (lower right), locate and double-click the Input.LogMile. The function now looks like: CREATEPOLYLINE(Input.CoordGeocodePoint,Input.LogMile) GeoMedia Functional Geometry 71 15. Click Add to save the function. The dialog is cleared and is now ready to build more functions. 16. Click Close to return the Analytical Merge dialog. 17. Right-click in a blank area of the Output functional attributes section. 18. Select New > Min > LogMile.
A new function called MinofLogMile is added to the list of Output Functional Attributes. 19. Once again right-click in the Output functional attribute section and select New > Max > LogMile A new function called MaxofLogMile is added to the list of the Output Functional Attributes.
20. Change the Query name to Q2 Merge of Q1 for Route Lines (see graphic below). 21. Optionally use the Style button to select Streets as the style. Intergraph Tech Note
72
22. Click OK to run the Analytical Merge query to CREATEPOLYLINE of the point geometries. The lines representing the routes are displayed. 23. Try double-clicking on the lines to review their properties. 24. Notice how Route 26 is not broken at the intersections. This could be corrected by outputting the data to a read-write warehouse and then using other editing tools such as Tools > Validate Connectivity to correct. In out data however, we do have segment or section numbers that denote the different sections of road. Modifying the Merge Criteria Using Analysis Queries 1. Select Analysis > Queries 2. On the Queries dialog, double-click on the Q2 Merge of Q1 for Route Lines query. The Query Properties for the Q2 Merge query appear. 3. Check the Section attribute in the Attributes section (see graphic below). GeoMedia Functional Geometry 73
4. Click OK and Close the save the change. 5. Once again review the graphic lines and note how the lines are broken out by Route and Section. Notes: When using functional attributes, the new Geometry is added to the query so that there are multiple Geometries. When using the Analytical Merge command (as in the workflow above), only the explicit attributes and geometry created will be in the output. For example if you use Legend > Add Legend Entries to add the Merge query to the map view then there will only be one legend entry (in the case of our Merge query). CREATEPOLYLINE in Functional Attributes (A Scalar Example) Reviewing the Data In the following data example, we have records which contain x1,y1 coordinate that represent the beginning of line segment. In the same record we have x2,y2 coordinates that represent the end of a line segement. 1. Use the Window > New Data Window command to expand the Madco connection and create a new data window view for Seg_Info.
2. Notice how each record has both beginning and ending latitude coordinates. 3. After reviewing the data, close (X) the data window. We will use the Geocode Coordinates command twice to place points for both the beginning and the end of the line segments. Geocoding Coordinates for Line Begin Points 1. Select Analysis > Geocode Coordinates 2. Click in the Geocode attributes in field, expand the Madco connection and select Seg_Info as the source table to Geocode. Intergraph Tech Note
74
3. Define Begin_Lat as the Latitude value. 4. Define Begin_Long as the Longitude value. 5. Change the Query name to: LogPoints Begin (see graphic below).
6. Click OK to place the points for the beginning of the segments. Geocoding Coordinates for Line End Points It takes two points to draw a line so we want to generate new point geometry for the end of the line. The tick here is that we will store this new ending geometry along the results of the beginning point geometry.. What does this mean? We will create another Geocode coordinate query but instead of using the original Seg_Info table, we will input the last Geocode query. The resulting Geocode coordinates query will then have two point geometry columns, one for the start point, and one for the end point. 1. Select Analysis > Geocode Coordinates 2. Click in the Geocode attributes in field, expand the Queries connection and select LogPoints Begin as the source table to Geocode (see graphic below). GeoMedia Functional Geometry 75
3. Define End_Lat as the Latitude value. 4. Define End_Long as the Longitude value. 5. Change the Query name to: LogPoints All (see graphic below).
6. Click OK to place the points for the ends of the segments. Using Functional Attributes to CREATEPOLYLINE CREATEPOLYLINE is probably most often used in its aggregating form as part of Analytical Merge. It can however be used in Scalar mode in Functional Attributes, IF there are multiple point geometries Intergraph Tech Note
76 available in each record.. i.e. if you add the feature class or query to the legend and it creates 2 or more point legend entries then it can most likely be used with CREATEPOLYLINE in Funtional Attributes. 1. Select Analysis > Functional Attributes. 2. Click in the Add functional attributes for field, expand the Queries section and select LogPoints All as the input.
3. Click on the New button. 4. Key in Geom_Line as the Functional attribute name.
5. Use your skills to build the following Geometry function:
CREATEPOLYLINE(Input.CoordGeocodePoint,Input.CoordGeocodePoint1) Once you see the output type as Line geometry, then the syntax is probably correct.
6. Click Add 7. Click Close The main Functional Attributes dialog is displayed. 8. Set the Query name to: FA Log Segments
9. Display the results only in the map view. 10. Optionally, use the Style button to select Streets. GeoMedia Functional Geometry 77
11. Select OK to display the query in the map view. 12. Select the Fit All command to fit the graphics to the map view. 13. Notice how one of the segments extends southward in zinger like fashion. This is most likely a mistake in the source data ending latitude value. Query Notification All of the queries used in Geomedia support notification which means that if the input record changes, then the query will update. This is true even if there are queries built on queries (one query serves as input to another). 1. Use the Select Tool to double-click the zinger line. The Properties for FA Log Segments appears. The Ending Latitude here is incorrect. 2. Change the End_Lat value to 34.87147
3. Click OK to save the change. The functional query, FA Log Segments automatically updates. Intergraph Tech Note
78
Other (version 6.1) Nearest Aggregation Workflow (version 6.1) Scenario: Suppose you need to find the nearest Transformer ID to each house. Setup 1. Select Legend > Legends. 2. Select Downtown Base Map Named legend then select Replace and Yes on the warning message to replace the current map legend.
3. Use Legend > Add Legend Entries to expand the Madco connection and display Transformers on the map. 4. Optionally double-click one of the transformers to review its properties. The goal here is for every building to know the nearest transformer ID. When comparing two feature classes, often the Aggregation command is the tool of choice. Aggregating 1. Select Analysis > Aggregation 2. On the Aggregation dialog, click on the From detail features in list, expand Madco connection and select Transformers as the Detail Feature class (see graphic below). 3. On the Aggregation dialog, click on the Aggregate to summary features in list, expand Madco connection and select structures as the input Summary Feature class. GeoMedia Functional Geometry 79
Note: Before using this command it may be useful in your workflows to first perform attribute and/or spatial queries to limit the data to valid choices. For example, in this case we are obtaining the nearest transformer ID from all transformers to all structures. In reality, we might first perform an attribute query that limited the transformer types to only types associated with structures. In this data we might limit the summary feature, structures, to those that touch an address point (utility bill point). 4. Notice the list of tabs in the mid portion of the dialog. The relation between the Transformers and the Structures can be made based on spatial relationships, Attribute Relationships or both spatially and by attributes. We will use a spatial relation only. 5. Click in the list of spatial operators and select accumulate nearest (see graphic below).
6. Click on the Output tab. 7. Right-click in the Output functional attributes field and select, New > FIRST > Multiple Attributes (see graphic below). Intergraph Tech Note
80
The Multiple Attributes for FIRST dialog appear. This dialog allows you to pick multiple attributes to carry over from the detail feature class (Transformers) to the input Summary feature class (Structures). 8. Select ID and trantype attributes.
9. Select OK. The FirstOf attributes are added to the Output attributes list. 10. Optionally, you could use the Properties button to modify the output attribute names. Calculating Distance to the nearest Transformer 1. Select the New button. The Functional Attribute dialog is displayed. GeoMedia Functional Geometry 81 2. Key in Trans_Dist into the Functional attribute name field. 3. Click on the Geometry category. 4. Locate and double-click on DISTANCE in the Functions list. DISTANCE() is added to the Expression field. 5. Note the syntax for DISTANCE at the bottom of the dialog. 6. In the list of Attributes (lower right) locate and double-click Detail.Geometry. 7. Key in a comma , character. 8. In the list of Attributes, locate and double-click Input.AreaGeometry. The Expression field now looks like: DISTANCE(Detail.Geometry,Input.AreaGeometry) The next step will show you an error message. 9. Click on Add. The following error message is posted:
The syntax when detail items are being compared must be modified to return only one solution EVEN if every solution will have one answer. We could modify the expression to use the FIRST distance since there will ultimately be only one distance returned. 10. Highlight the current expression and then right-click and select Cut (see graphic below).
The Expression is cut into your paste buffer. 11. Click on the Misc Category. 12. In the list of Functions, locate and double-click on the FIRST function. FIRST() is added to the Expression field. 13. Right-click in the Expression field and select Paste. The function should now look like: FIRST(DISTANCE(Detail.Geometry, Input.AreaGeometry)) (see graphic below) Intergraph Tech Note
82
14. Click Add to add the function. 15. Close the Functional Attributes dialog. 16. Click OK on the Aggregation dialog to run the command. 17. Review the attributes of the Aggregation query features (the structures).
Additional information on Intergraph Support and Services is available on the Internet. Use a World Wide Web browser to connect to Intergraph Online at http://wwwIntergraph.com, and follow the links from Support. For general Intergraph information, call 1-800-791-3357 (U.S. and Canada) or 1-256-730-2000 (international). GeoMedia Functional Geometry November 2007