Select to view content in your preferred language

Why is (SHAPE).ENTITY different from SDE.ST_ENTITY(SHAPE)?

516
1
Jump to solution
10-31-2023 09:56 AM
Labels (1)
Bud
by
Honored Contributor

Oracle 18c; 10.7.1 EGDB; SDE.ST_GEOMETRY


I can generate a feature using SQL that has a Nil (zero-vertex) geometry:

Bud_0-1698771468853.png

select
    shape,
    (shape).points as geometry,
    sde.st_area(shape) as area,
    sde.st_isempty(shape) as is_empty,
    (shape).entity,
    sde.st_entity(shape),
    (shape).numpts
from
    (select 
        sde.st_polyfromtext('POLYGON EMPTY') as shape
    from 
        dual)  

As shown, there seem to be two different ways of determining the entity number using SQL:

  1. (SHAPE).ENTITY 
  2. SDE.ST_ENTITY(SHAPE)
    • ST_Entity SQL function

      0

      nil shape

      1

      point

      2

      line (includes spaghetti lines)

      4

      linestring

      8

      area

      257

      multipoint

      258

      multiline (includes spaghetti lines)

      260

      multilinestring

      264

      multiarea

Why does (SHAPE).ENTITY return a different value than SDE.ST_ENTITY(SHAPE)?

Should (SHAPE).ENTITY be 0, not 16, to indicate that the geometry is Nil?

0 Kudos
1 Solution

Accepted Solutions
Bud
by
Honored Contributor

Esri Case #03475191 - SDE.St_Geometry: Why is (SHAPE).ENTITY different from SDE.ST_ENTITY(SHAPE)?

...it looks like the ST_Entity function is taking the entity member field from the ST_Geometry entry and providing the corresponding return based on a calculation. As you can see in the following screenshot, when the numpts value and len value are 0, the value in the entity member field is disregarded: 

 

Bud_0-1698948897769.png

As the ST_Entity function is providing the correct result for this geometry type (0 for nil), it is likely that the way nil values are stored in the entity member field isn't documented in the same way that something like ST_NumPoints is, where an explanation of these differences between the function and the attribute is provided: 

Bud_1-1698948897774.png

https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/st-numpoints.htm

The value 16 apepars to be a result of a bitmask operation but it gets a bit difficult to track down the function logic in the ST_GEOM_UTIL procedure and unfortunately there is no published reference. 

 

View solution in original post

1 Reply
Bud
by
Honored Contributor

Esri Case #03475191 - SDE.St_Geometry: Why is (SHAPE).ENTITY different from SDE.ST_ENTITY(SHAPE)?

...it looks like the ST_Entity function is taking the entity member field from the ST_Geometry entry and providing the corresponding return based on a calculation. As you can see in the following screenshot, when the numpts value and len value are 0, the value in the entity member field is disregarded: 

 

Bud_0-1698948897769.png

As the ST_Entity function is providing the correct result for this geometry type (0 for nil), it is likely that the way nil values are stored in the entity member field isn't documented in the same way that something like ST_NumPoints is, where an explanation of these differences between the function and the attribute is provided: 

Bud_1-1698948897774.png

https://desktop.arcgis.com/en/arcmap/latest/manage-data/using-sql-with-gdbs/st-numpoints.htm

The value 16 apepars to be a result of a bitmask operation but it gets a bit difficult to track down the function logic in the ST_GEOM_UTIL procedure and unfortunately there is no published reference.