Transform - Geometry: Copy

The Copy template appears in the template list when a geometry field, of type geom, geommfd, or geomwkb, has been picked in the Transform pane.   It extracts geometry values and characteristics.

 

Copy

Provides numerous operators to extract or to compute geometry characteristics and to save to the specified Result destination, using the data type required and providing rich options for each operation.  Available operations include:

 

  • area - Compute the area covered by a polygonal area in the specified square units, using either geodetic or planar computation.
  • bearing - Compute the bearing direction from the first coordinate of the object to the last coordinate of the object using either geodetic or planar computation.
  • branch - Extract and save as an object the given branch number.
  • coordinate x - Report the x value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.
  • coordinate xy - Report the xy vector value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.
  • coordinate xyz - Report the xyz vector value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.
  • coordinate y - Report the y value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.
  • coordinate z - Report the z value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.
  • geometry - Copy the geometry of the object.
  • length - Report the length of the object using either geodetic or planar computation.
  • number of branches - Report the number of branches in the object.
  • number of coordinates - Report the number of coordinates in the object.
  • number of curves - Report the number of curvilinear segments in the object.
  • radius - The radius of the minimum enclosing circle for an object, useful for ranking geometry values by size.
  • rectangle - Report the coordinates (lower left corner, upper right corner) of the minimum, vertically-oriented, enclosing rectangle as an x4 value.
  • type - Report areas as type 3, lines as type 2, and points as type 1.
  • x max - Report the largest x coordinate value in the object.
  • x min - Report the smallest x coordinate value in the object.
  • y max - Report the largest y coordinate value in the object.
  • y min - Report the smallest y coordinate value in the object.
  • z max - Report the largest z coordinate value in the object.
  • z min - Report the smallest z coordinate value in the object.

 

Launch the template by choosing a geometry field and then double-clicking the Copy template.  When the template launches we can specify options.

 

 

Copy : area

Copy into the Result destination field the area in specified square units covered by each polygonal area object, using either geodetic or planar computations.  Save NULL for lines and points.

 

We use a sample drawing that contains five area objects.

 

 

The drawing's table contains only an identity field and a geometry field, and no other attribute fields.

 

 

With the focus on either the opened drawing window or the table window, in the Transform pane we choose either the Area objects drawing, or the Area objects Table as the source and Geom as the field.

 

 

We double-click the Copy template to launch it.

 

 

In the Copy template we choose area as the Use option, and Meter as the unit of measure.   The  Unit pull down box has a very long list of units of measure we can use, all linear units regardless of whether the drawing is in a projection that uses angular or linear units as native units of measure.

 

The Measure box allows a choice of auto or geodetic to specify how the computation should be done.  The auto choice uses planar, that is, Euclidean, computations for all projections using linear units of measure and it uses geodetic computations for all projections, like Latitude / Longitude, that use angular units of measure where a planar computation would be a poor choice.   The geodetic choice always uses geodetic computations, which calculate area over the surface of the projection's ellipsoid using high precision Vincenty formulae.

 

In the Result box enter the name for the new field that will be created in the table into which the results will be saved.  We can use whatever name we want, but it is wise to use a name that reminds us what that field contains.  We will use Area m2 as the name for the result field.

 

Press Transform.

 

 

Immediately, in the drawing's table a new Area m2 field appears, populated with the area in square meters of each of the area objects.

 

By default, the Result type was float64, so the numbers are full precision float64 floating point numbers.   If we wanted integer numbers, we could use a different Result type.

 

 

For example, we can re-run the transform (it remembers all the previous settings) but changing the Result type to int32 and changing the name of the destination Result field to Int m2.

 

Press Transform.

 

 

A new Int m2 field appears in the drawing's table.   The new field is populated with integer values for the areas in square meters of each object.   

 

Note that integer values are not the same thing as rounding a floating point value.  For example, the floating point value for object number 3 is 8461.512... which would normally round up to 8462, yet that value as an integer data type is 8461.

 

If we prefer rounded numbers, that is easy to do.

 

 We press the Up button to go up one level back to the list of templates.

 

We choose the Area m2 field, and then we double-click the Round template.

 

 

In the Round template we use defaults.  Defaults for the Round template are to round to nearest (round).   The to nearest (round) choice will round up from values like 123.51 but will round down for values like 123.49, the usual "rounding" behavior most people expect.

 

 

The Round to box allows us to choose what decimal position of rounding we wish.  Choosing 1 rounds to whole integers.  That is what we want, so we leave the default choice of 1 in place.

 

The Result destination we also leave at the default Same Field, since we want to round the values in the Area m2 field in place.

 

Press Transform.

 

 

Immediately, the values in the Area m2 field are rounded to whole integer values.   The 8461.512... value has been rounded up to 8462, as we wanted.  

 

 

In the Project pane, we can right-click on the Area objects drawing and create a new Labels component using the Area m2 field for the area text.   In the illustration above we have dropped that new labels component into the Area objects window, to show the area in square meters of each polygonal area object.

 

Copy : bearing

Copy into the Result destination field the bearing direction from the first coordinate of the object to the last coordinate of the object using either geodetic or planar computation.   Save NULL for areas and points.

 

We use a sample drawing that contains seven lines and one area.  

 

 

Lines have been Styled to put an arrowhead at the end of each line.  

 

 

The drawing's table has only an identity field and a geometry field, and no other attribute fields.

 

With the focus on the drawing window, in the Transform pane we choose the Bearing lines drawing and the Geom field.  

 

We double-click on the Copy template to launch the template in the Transform pane.

 

 

In the Copy template we choose area as the Use option, and Degree as the unit of measure.   The  Unit pull down box allows a choice of arc minutes, arc seconds, radians, or degrees.

 

The Measure box allows a choice of auto or geodetic to specify how the computation should be done.  The auto choice uses planar, that is, Euclidean, computations for all projections using linear units of measure and it uses geodetic computations for all projections, like Latitude / Longitude, that use angular units of measure where a planar computation would be a poor choice.   The geodetic choice always uses geodetic computations, which calculate bearings over the surface of the projection's ellipsoid using high precision Vincenty formulae.

 

In the Result box enter the name for the new field that will be created in the table into which the results will be saved.  We can use whatever name we want, but it is wise to use a name that reminds us what that field contains. We will use Bearing in degrees as the name for the result field.

 

Press Transform.

 

 

Immediately, a new Bearing in degrees field appears, populated with bearings for each line.  The Bearing in degrees field for the area object contains a NULL, since neither points nor areas have bearings.

 

Pending update  Bearings currently use positive numbers from 0 to 180 for bearings in the Eastern semicircle and negative numbers from 0 to -180 for the Western semicircle.   That will be adjusted to use compass bearings in upcoming builds, given that most people think in compass bearings.

 

Until that adjustment is made, we can use Expression to convert to compass bearings, as shown below.

 

We used a float64 data type for the bearings to get total precision, but having so many digits to the right of each decimal point is inconvenient for labels.  We can use Round to round the numbers to even integers.

 

 We press the Up button to go up one level back to the list of templates.

 

We choose the Bearing in degrees field, and then we double-click the Round template.

 

 

In the Round template we use defaults.  Defaults for the Round template are to round to nearest (round).   The to nearest (round) choice will round up from values like 123.51 but will round down for values like 123.49, the usual "rounding" behavior most people expect.

 

The Round to box allows us to choose what decimal position of rounding we wish.  Choosing 1 rounds to whole integers.  That is what we want, so we leave the default choice of 1 in place.

 

The Result destination we also leave at the default Same Field, since we want to round the values in the Area m2 field in place.

 

Press Transform.

 

 

The Bearing in degrees values are rounded to whole integers.

 

 

We can create labels from the Bearing lines drawing using the Bearing in degrees field, and then drop the labels into the map.   In the illustration above we Style the labels using a halo of white color to allow the labels to be seen clearly against the line.

Converting to Compass Bearings

Upcoming builds will adjust bearings to always report compass (0 to 360) bearings instead of +/- 0 to 180 bearings.  Until that adjustment is made, we can convert bearings to 0 to 360 style using the expression:

 

CASE WHEN ([Bearing in degrees] < 0)

   THEN 360 + [Bearing in degrees]

   ELSE [Bearing in degrees]

   END

 

We can add a computed field to the drawing's table, or we can use the Expression template in the transform pane.

 

With the focus on the Bearing lines window, in the Transform pane we choose the Bearing in degrees field and then we double-click the Expression template.

 

 

In the template we enter the expression:

 

CASE WHEN ([Bearing in degrees] < 0)

   THEN 360 + [Bearing in degrees]

   ELSE [Bearing in degrees]

   END

 

We specify Compass as the name of the new result field to be created.   Press Transform.

 

 

A new Compass field appears in the drawing's table giving bearings in 0 to 360 degree form.

 

 

Right-clicking on the labels component, in the properties we can change the field used for the labels text from the Bearing in degrees field to the Compass field, and the labels will update as seen above.

 

Copy : branch

Copy into the Result destination the branch indicated of a multibranched object and discard other branches.  The result destination can be a new geometry field in the same table or a new table.  Branches are numbered starting with 0 in the order in which they occur within the object's geometry.   

 

 

The starting drawing above shows one area object that is made of up three branches and one line object that is made up of three branches.  Labels have been added to the illustration to show the number of each branch, with labels for the multibranched area in magenta and labels for the multibranched line in light blue color.

 

 

We copy the result of branch using a Value of 0 into a new result field called GeomTemp and then we create a new Branches Temp drawing.

 

 

We drag and drop the Branches Temp drawing into our Branches Drawing.    The new geometry field holds the geometry from the first branch (zero based counting) of the area object and the first branch of the line object.

 

 

We change Value to 1 and the Result destination to the GeomTemp field we just created.  Press Transform.  The result of branch using a Value of 1:

 

 

The geometry field now holds the geometry from the second branches of the area and line.

 

We repeat the branch operation using a Value of 2:

 

 

Copy : coordinate x

Report the x value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.

 

Consider a drawing, called Places Drawing, which shows the various cities as points.

 

 

The drawing's table has a Geom field that provides the geometry for each point.   We would like to extract the X coordinate from the geometry for each point and then save that X value into a newly created longitude field.  

 

In the Copy : coordinate y transform discussion, we will extract the Y coordinate from the geometry for each point and then save that Y value into a newly created latitude field.  The final result will be adding latitude and longitude fields to the table, so that we can export the latitude and longitude locations for each city to software that cannot read geometry values.

 

With the focus on the Places table, in the Transform pane we choose the Geom field and then double-click the Copy template to launch it.    We could also run the transform with the focus on the map window, in the Transform pane choosing the Places Drawing layer and the Geom field.

 

 

In the Copy template we choose coordinate x as the Use option, and we enter 0 as the Value, that is, the number of the coordinate desired.   Choosing 0 means to extract the X coordinate values for the location of the first coordinate (zero based numbering means 0 is the first coordinate) in each object.  Points only have one coordinate, the first coordinate, so that means we will extract the X coordinate for the location of each point.

 

We choose New Field for the Result destination, entering Longitude as the name we would like the new field to use.   Press Transform.

 

 

The template adds a new Longitude field to the table, and populates it with the x coordinate value from the geometry for each point.

 

Copy : coordinate xy

 

Copy : coordinate xyz

Given a geom (line or area) and the number of the coordinate desired within that object, return the X, Y or X, Y, Z values for that coordinate.  The template follows branches in order. If the coordinate number given is beyond the first branch, the count of coordinates continues into the second branch, and then into the third, and so on until the desired coordinate is reached.  

 

The Copy: coordinate xy template takes data from a geom and saves the result into an x2 type field, and the Copy : coordinate xyz template takes data from a geom and saves the result into an x3 type field. These templates write either an x2 value for the X,Y location of a given coordinate in an object,  or an x3 value for the X,Y location and Z value of the given coordinate.  The Copy : coordinate xyz template requires the geom from which it takes data to have a Z value.  If the geom does not have a Z value, the results will be NULL.

 

 

Consider a drawing with lines and area objects, all of which have a Z value as part of their geometry.

 

 

The drawing's table has a Geom field that provides object geometry.    We will use the transform templates to add a PositionXY field of type float64x2, and a PositionXYZ field of type float64x3.   We also will add a second geometry field that we will use to illustrate how to reconstruct geometry from an x2 coordinate field.

 

With the focus on the Lines and Areas table we switch to the Transform pane.  We choose the Geom field and then double-click the Copy template to launch it.

 

 

We choose coordinate xy as the Use option, and we enter 0 as the Value, that is, the number of the coordinate desired.   Choosing 0 means to extract the X,Y coordinate values for the location of the first coordinate (zero based numbering means 0 is the first coordinate) in each object.

 

We choose New Field for the Result destination, entering PositionXY as the name we would like the new field to use.   Press Transform.

 

The template adds a new PositionXY field to the table, and populates it with x2 (a numeric vector with two values in the vector, one for X and one for Y) values that give the location in local units of the first coordinate in each object.

 

 

To see what the coordinate xyz option does,  we choose coordinate xyz as the Use option, also using 0 for the Value giving the coordinate position in the sequence of coordinates that define each object.   We again choose the New Field option for the Result, entering the name PositionXYZ for the new field.

 

Press Transform.

 

 

The template adds a new PositionXYZ field to the table, and populates it with x3 (a numeric vector with three values in the vector, one for X, one for Y, and one for Z) values that give the location in local units of the first coordinate in each object and also the Z value encoded in the geometry field.

 

 

We can get a better look at the PositionXYZ field contents by widening the column, and hiding the mfd_id field, to provide more room in the illustration.    We can see how the x3 numeric vector values in the PositionXYZ field consist of three numbers giving X, Y, and Z for each object.  The Z values are all trivial, a Z value of 1 for each object.

 

To see what the XY values mean, and to visually see the connection between the objects in the drawing and the XY coordinate values we have extracted, we can create a third, geometry field in the table that composes the XY values into a point object.  We can then plot those point objects in a drawing to see where they appear.   The Transform pane makes that easy.

 

With the focus still on the Lines and Areas Table, and still using the Geom field, we go up one level to the list of templates and choose the Expression template.

 

 

We click Edit Expression, and in the Expression dialog that pops open we enter the expression

 

GeomMakePoint(GeomCoordXY([Geom], 0))

 

That expression takes the Geom field and creates x2 coordinate values for the first coordinate in the object using the same SQL function the coordinate xy template option uses internally.  The expression then takes that value and builds a point object from it using the GeomMakePoint function.   

 

If we wanted to make use of the PositionXY field we have already populated with the coordinate xy operation we could get exactly the same result by writing the expression as

 

GeomMakePoint([PositionXY])

 

Press OK in the Expression dialog and back in the Transform pane we choose New Field as the Result destination, entering PositionGeom as the new field.  Since we are creating a new geometry field, the Transform pane offers to create a New Drawing based on that new geometry field as well.  We name that new drawing Positions.

 

Press Transform.

 

 

The template adds a new PositionGeom field to the table, and populates it with point object geometry values where the point objects are located at the coordinate location given by the XY coordinate values extracted from the first coordinate of each object.

 

A new Positions drawing also appears in the Project pane.   We can drag and drop that Positions drawing as a new layer into our Lines and Areas drawing.

 

 

We use Style to format the points in the Positions layer as bright green dots.  We can see how each point is located at the first coordinate in each object.

 

Suppose we now edit the expression to use the second coordinate of each object.

 

We click Edit Expression again, and in the Expression dialog we edit the expression that is still there to change the 0 to a 1.

 

GeomMakePoint(GeomCoordXY([Geom], 1))

 

The syntax of the GeomCoordXY function is that the second argument gives the position, using zero based counting, of the coordinate of interest.   Using 1 as the argument gets the second coordinate in the object.

 

Press OK in the Expression dialog to return to the Transform pane.   Back in the Transform pane, we choose an existing field, the PositionGeom field we created in the prior transform operation, as the Result destination.

 

Press Transform.

 

 

The Positions drawing still takes its geometry from the PositionGeom field, so like magic the points in the Positions drawing now move to the second coordinate of each object (coordinates that define areas are ordered counter-clockwise about the area boundary).

 

Copy : coordinate y

Report the y value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.

 

Consider a drawing, called Places Drawing, which shows the various cities as points.  We will continue the example started in the discussion of the Copy : coordinate x transform operation.

 

 

 

The drawing's table has a Geom field that provides the geometry for each point.   In the discussion of the Copy : coordinate x transform operation we created a Longitude field into which we copied the X coordinate for each point.   

 

We now would like to extract the Y coordinate from the geometry for each point and then save that Y value into a newly created latitude field.  The final result will be adding latitude and longitude fields to the table, so that we can export the latitude and longitude locations for each city to software that cannot read geometry values.

 

With the focus on the Places table, in the Transform pane we choose the Geom field and then double-click the Copy template to launch it.    We could also run the transform with the focus on the map window, in the Transform pane choosing the Places Drawing layer and the Geom field.

 

 

In the Copy template we choose coordinate y as the Use option, and we enter 0 as the Value, that is, the number of the coordinate desired.   Choosing 0 means to extract the Y coordinate values for the location of the first coordinate (zero based numbering means 0 is the first coordinate) in each object.  Points only have one coordinate, the first coordinate, so that means we will extract the Y coordinate for the location of each point.

 

We choose New Field for the Result destination, entering Latitude as the name we would like the new field to use.   Press Transform.

 

The template adds a new Latitude field to the table, and populates it with the x coordinate value from the geometry for each point.

 

Copy : coordinate z

Report the z value of the given coordinate number counting from the start or end of the sequence of coordinates that defines the object.

Copy : geometry

Copy geometry from the source field into the Result destination, including copying and automatic conversion between different geometry types (geom, geommfd, geomWKB).  Used with table or drawings.  The Result destination can be an existing geometry field in the table, or a new geom field created by the template in the same table (with a new drawing using that new field as well), or a new table and drawing created by the template.

 

 

With the focus on our example Objects Drawing, in the Transform pane we choose the Geom field and then the Copy template.

 

 

In the Copy template we choose geometry as the Use option, and we choose New Field for the Result destination, entering the name Tgeom as the name for the new field and Temp Objects Drawing as the name of the new drawing that will display that new field.

 

Press Transform.

 

 

The template creates a new field called Tgeom in the table, and populates it with a copy of the geometry in the Geom field for each record.

 

 

We can pop open the new Temp Objects Drawing to see the objects are a copy of those in the original Objects Drawing.  In the illustration above we have styled the new drawing using green color.

 

Having two geometry fields in the same table, with the same data in each, can be useful to have a backup copy of starting data when doing intricate transforms, in case we ever make a mistake and would like to restore the original version of objects from a backup copy.

 

Suppose, for example, in our original table we select two of the areas:

 

 

We then apply a complex transform using an expression restricted to the selection, but we make a mistake in the expression.

 

 

Suppose we click too quickly without looking at the preview first and the result is we put NULL values into the geometry for the areas.  That makes them disappear.  Oops!  We can get them back by using Copy to copy Tgeom into Geom.

 

 

We choose the Tgeom with the Copy template using the geometry option, and we choose Geom as the Result destination.   Check Transform selection only to apply the template only to selected records.     Press Transform.

 

 

The template copies geometry in selected records from Tgeom into Geom, restoring the two areas we inadvertently NULLed.

Convert between Geometry types

Copy will also convert between compatible geometry types, that is, between geom, geommfd, and geomWKB.   For example, we can convert between geometry in geom data type form and geometry in geomWKB data type form.

 

The following example launchs the transform template from an opened table, not from the drawing.  It is easier to see what the conversion does by looking at records in the table.

 

 

With the focus on the Objects table, in the Transform pane we choose the Geom field and then the Copy template.

 

 

In the Copy template we choose geometry as the Use option, and New Field for the Result destination, providing the name TgeomWKB for the new field to be created and WKB Objects Drawing for the new drawing that will display that new geometry field.

 

Press Transform.

 

 

The template creates a new TgeomWKB field in the table and populates it with geometry in WKB (well known binary) form, automatically converting Manifold geom types into WKB geomWKB types.

Convert to Other Types

The Copy template will automatically convert between types that are closely compatible, but to convert between types that are not closely compatible, such as from binary geometry form into text representations of geometry, we can use the Expression template.

 

Suppose, for example, we would like to convert geometry into WKT (well known text) text form.  We create a field in the table called Text_WKT of type varchar.  

 

 

With the focus on the Objects table, In the Transform pane we choose the Text_WKT field and then the Expression template.

 

 

In the Expression  template we press the Edit Expression button and then in the Expression dialog we enter the expression:

 

GeomWkt([Geom])

 

We press OK in the Expression dialog to return to the Transform pane.   In the Transform pane we choose (same field) as the Result destination.  Press Transform.

 

 

The template evaluates the SQL expression on the fly, using whatever is the value of Geom for that record within the GeomWkt function to converts Manifold geometry in geom data type form into a text string that represents geometry using WKT (well known text) conventions.

 

Copy : length

Report the length of objects using either geodetic or planar computation.   Given a geometry field that contains a line object or area object, place the length of a line object or the length of an area's boundary into the specified Result destination.  The length reported for a branched object is the sum of the lengths of the branches.  Points have NULL lengths.

 

 

We open our sample drawing, which has three areas, two lines and two points.  We open the drawing's table as well, so later we can see the field the transform will add.

 

With the focus on either the drawing window or the table window, in the Transform pane we choose the Geom field.  

 

We double-click on the Copy template to launch the template in the Transform pane.

 

 

In the Copy template we choose length as the Use option, and Meter as the unit of measure.   The  Unit pull down box has a very long list of units of measure we can use, all linear units regardless of whether the drawing is in a projection that uses angular or linear units as native units of measure.

 

The Measure box allows a choice of auto or geodetic to specify how the computation should be done.  The auto choice uses planar, that is, Euclidean, computations for all projections using linear units of measure and it uses geodetic computations for all projections, like Latitude / Longitude, that use angular units of measure where a planar computation would be a poor choice.   The geodetic choice always uses geodetic computations, which calculate area over the surface of the projection's ellipsoid using high precision Vincenty formulae.

 

In the Result box enter the name for the new field that will be created in the table into which the results will be saved.  We can use whatever name we want, but it is wise to use a name that reminds us what that field contains.  We will use Length as the name for the result field.

 

Press Transform.

 

 

Immediately, in the drawing's table a new Length field appears, populated with the length in meters of each of the objects.  The boundary of the first area is not quite 316 meters in length.   The two points have NULL lengths since points are dimensionless.  

 

By default, the Result type was float64, so the numbers are full precision float64 floating point numbers.   If we wanted integer numbers, we could use  the Round : to nearest (round) operation to create a rounded, integer number.

 

With the focus on the open table window, we choose the Length field and then we double-click the Round template to launch it.

 

 

In the Round template we use defaults.  Defaults for the Round template are to round to nearest (round).   The to nearest (round) choice will round up from values like 123.51 but will round down for values like 123.49, the usual "rounding" behavior most people expect.

 

In the Result box we choose New Field and enter Rounded for the name of the new field.  We choose int32, an integer numeric type, for the Result type.

 

Press Transform.

 

 

Immediately, in the drawing's table a new Length field of type int32 appears, populated with the rounded value of the Length field.    The two points still have NULL lengths since the result of rounding a NULL is still a NULL.

 

Copy : number of branches

Compute the number of branches in each object, and save to the specified Result destination.

 

We start with a drawing that contains two objects.  One is a multibranched area that appears to be three different area objects but which in fact is a single area object that has three "island" branches.

 

 

The other object is a multibranched line that appears to be three different line objects but which is a single line object with three branches that are not contiguous.    Opening the drawing's table, we can see there are only two objects.

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose number of branches as the Use option.  

 

For the Result destination, we choose New Field and then enter Branches as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64.

 

If we preferred, we could have chosen some other existing numeric field in the table.

 

Press Transform.  

 

 

The template creates a new float64 type field called Branches and populates it with the number of branches for each object.

 

The drawing shows what visually appear to be three areas and three lines, but the table contains only two records.  The first record is for a multibranched area that has three branches, and the second record is for a multibranched line that also has three branches.   The template thus reports 3 as the number of branches for both records.

 

Copy : number of coordinates

Compute the number of coordinates in each object, and save to the specified Result destination.

 

We begin with our example drawing that shows three areas, two lines and two points.  

 

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose number of coordinates as the Use option.  

 

For the Result destination, we choose New Field and then enter Coordinates as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64.

 

If we preferred, we could have chosen some other existing numeric field in the table.

 

Press Transform.  

 

 

The template creates a new float64 type field called Coordinates in the drawing's table, and populates it with the number of coordinates for each object.

 

A rectangular area object contains 5 coordinates because the last coordinate is the same as the first coordinate, to close the area.

 

Copy : number of curves

Compute the number of curvilinear segments in each object, and save to the specified Result destination.

 

We begin with our example drawing that shows three areas, two lines and two points.   One of the lines, the line in the center of the view, has a curvilinear segment.  No other object has any curvilinear segments.

 

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose number of curves as the Use option.  

 

For the Result destination, we choose New Field and then enter Curves as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64.

 

If we preferred, we could have chosen some other existing numeric field in the table.

 

Press Transform.  

 

 

The template creates a new float64 type field called Curves in the drawing's table, and populates it with the number of coordinates for each object.

 

Copy : radius

Compute the radius of the minimum enclosing circle for each object, and save to the specified Result destination.  Minimum enclosing circles for objects are useful for ranking objects by their overall size.

 

We begin with our example drawing that shows three areas, two lines and two points.

 

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose radius as the Use option, and Meter as the unit of measure.   The  Unit pull down box has a very long list of units of measure we can use, all linear units regardless of whether the drawing is in a projection that uses angular or linear units as native units of measure.

 

The Measure box allows a choice of auto or geodetic to specify how the computation should be done.  The auto choice uses planar, that is, Euclidean, computations for all projections using linear units of measure and it uses geodetic computations for all projections, like Latitude / Longitude, that use angular units of measure where a planar computation would be a poor choice.   The geodetic choice always uses geodetic computations, which calculate area over the surface of the projection's ellipsoid using high precision Vincenty formulae.

 

For the Result destination, we choose New Field and then enter MEC radius (for "minimum enclosing circle radius") as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64.

 

If we preferred, we could have chosen some other existing numeric field in the table.

 

Press Transform.  

 

 

The template creates a new float64 type field called MEC radius in the drawing's table, and populates it with the radius, in meters, of the minimum enclosing circle for each object.  Points have a value of 0 for the radius, since they are dimensionless.

 

Copy : rectangle

rectangle - Report the coordinates (lower left corner, upper right corner) of the minimum, vertically-oriented, enclosing rectangle as an x4 value.

 

We begin with our example drawing that shows three areas, two lines and two points.

 

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose rectangle as the Use option.

 

For the Result destination, we choose New Field and then enter Rectangle as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64x4.

 

If we preferred, we could have chosen some other existing numeric x4  field in the table.

 

Press Transform.  

 

 

The template creates a new float64x4 type field called Rectangle in the drawing's table, and populates it with the four coordinate numbers giving the X0,Y0,X1,Y1 lower left and upper right corners of the minimum enclosing rectangles for each object.

 

Copy : type

Report areas as type 3, lines as type 2, and points as type 1, saving to the specified Result destination.

 

We begin with our example drawing that shows three areas, two lines and two points.    The drawing's table shows it has no attribute fields other than the mfd_id identity field and the geometry field.

 

 

With the focus on the drawing window, in the Transform pane we choose the Geom field and then we double-click the Copy template to launch it.

 

 

In the Copy template we choose type as the Use option.  

 

For the Result destination, we choose New Field and then enter Object type as the name of the new field to add to the table.  We could use whatever name we want, but it is wise to use names that remind us of what they are supposed to be.   We leave the Result type at the default float64.

 

If we preferred, we could have chosen some other existing numeric field in the table.

 

Press Transform.  

 

 

The template creates a new float64 type field called Object type in the drawing's table, and populates it with the numeric code for the type of object in that record: 3 for areas, 2 for lines, and 1 for points.

 

Copy : x max

Report the largest x coordinate value in the object, saving to the specified Result destination.

 

Copy : x min

Report the smallest x coordinate value in the object, saving to the specified Result destination.

 

Copy : y max

Report the largest y coordinate value in the object, saving to the specified Result destination.

 

Copy : y min

Report the smallest y coordinate value in the object, saving to the specified Result destination.

 

Copy : z max

Report the largest z coordinate value in the object, saving to the specified Result destination.

 

Copy : z min

Report the smallest z coordinate value in the object, saving to the specified Result destination.

 

 

Notes

Curvilinear segments - As a practical matter, most people doing GIS will use straight line segments for lines and areas.   Few GIS systems do a good job of supporting curved segments, so there is much less data published using curved segments.   Manifold's ability to work with curved segments allows us to use that data within Manifold in a limited way, at least for display and interactive editing.  

 

However, most processing tools in Manifold, such as Transform templates and various Geom SQL functions, do their work by first converting a curvilinear segment into a straight line segment between the same two start and finish coordinates.  That will often lead to weird or otherwise unexpected results.  To avoid such problems, first convert curvilinear segments into equivalent constellations of straight line segments at whatever resolution is desired, using the Clean transform template with the convert curves to lines operation option and the number of linear segments desired to approximate the curve in the Curve limit parameter.   See the Curved Segments discussion in the Drawings topic.

 

 

See Also

Transform Pane

 

Transform Reference

 

Transform - Expression

 

Transform - Geometry

 

 

 

.