I have a query in my legend created via Validate Geometry to display point locations for Short Vector segments. It says there are 21 entities displayed but none are. I have DISPLAY ON and have symbolized it as a red dot, but no dots show up. What am I doing wrong?
Queries output by the Validate Geometry command (including the Short Vector option) often include multiple (more than one) geometries. The Validate Geometry command outputs the original linework as the primary geometry. Any new geometry is output as secondary geometry; For example, the resulting Short Vector points representing the begin & end of short segments is created as a secondary geometry.
Most queries that generate new geometry create the new geometry as primary geometry but the Validate Geometry outputs original geometry as the primary geometry. The markers for the problem locations are output as secondary geometries.
If you use the Home tab, Legends > Add Legend Entries command then all geometries from the query should be displayed. Find below a detailed review of the logic.
Related Article: Primary vs. Secondary Geometry Fields
The Validate Geometry command creates 2 geometry fields. Both are compound geometry types. One of the geometry fields should show the original geometry and the other geometry field should show points (in a compound type style) that denote start and end of the short segment.
If you add the query to the legend using Home tab, Legends > Add Legend Entries then all geometry fields will be added the map legend.
Suppose we want to locate segments that are less than 100 m in the following 2 lines.
Then we’d run the Toolbox > Validate Geometry command with settings such as:
The resulting query now has 2 geometry fields. The geometry field names can be seen in Functional Attributes. If you select the query in the Analysis > Functional Attributes command then review the attribute field names you can see 2 geometry fields. (see graphic below)
There can only be one primary geometry. Depending on how the query is added to the map legend you may get all geometry fields (added as separate legend entries) OR a single geometry (the primary geometry field) which in this case is the original geometry. I say in “this case” because most queries that generate new geometry do NOT use the original geometry as the primary. Typically, the primary geometry is the new geometry that is created by the query command… In this case the primary is the line geometry (stored as compound) but the main thing to know for you is the following concept:
Key Concept: The Add Legend Entries command adds ALL geometry fields to the map legend. Adding the query via the Analysis Queries command only adds the primary geometry.
If we use Analysis > Queries command to Add the short segments to the legend we see the following (see graphic below):
Adding the query to the legend from the Analysis Queries dialog (using the Display option) adds only the primary geometry to the legend. In the graphic above we see a compound style that has the original geometry from each line for each short segment. For example, the top line has 2 short segments that are less than 100 m and the bottom line only has one segment that is less than 100 meters. The top line (ID1 = 206) has 2 lines stacked on top of each other, one for each short segment found in the line.
Now let’s remove this query from the legend and add the same query back to the map legend using Home tab, Legends > Add Legend Entries (or Right-click on map legend for the Add… option.
Now notice how 2 legend entries are added to the map legend. One legend entry for each geometry field found (see graphic below).
Hint: When there are multiple geometries added to the legend, the primary geometry is typically the one that carries the name of the originating query. Our query name was “LBK CL shapefile Short Segments”. The secondary geometry will have a legend entry named “geometry field name of… “
The Analysis > Selection command could be used to unselect undesired geometry fields. For example, if you do not want the linear geometry and only want the points you could use the Attribute Selection command to unselect the OriginalGeometry.
The resulting Attribute Selection query will contain only the points from the AnomalyGeometry field.
In the case of Short Vectors, you may notice that the points are geometry collections; for example, clicking on one point will cause 2 points to highlight. Sometimes it’s useful to get rid of geometry collections and return a set of single points. This can be done using Functional Attributes, GEOMETRIES expression.
The expression might look like: GEOMETRIES(Input.AnomalyGeometry)
You could go a step further to refine the expression to convert the compound points to true point geometries using FILTERPOINT expression which might look like FILTERPOINT(Input.AnomalyGeometry). Instead of creating these separately (thus creating 2 more extra geometry fields) we could combine the expressions above as:
The functional expression above will create a new primary point geometry field called “Geom_Expanded_Ponits”.
Once again, the original geometry fields are still present and will be seen on the legend if you add via Legend > Add Legend Entries. If you add from the Queries dialog, only the primary geometry is added. Keep in mind that you could use Attribute selection to get rid of (unselect) undesired geometry fields.