ArcSDE C-API - SE_stream_calculate_layer_extent & SE_log_calculate_extent failure?

362
1
08-25-2010 02:36 AM
A_Weber
New Contributor
Hello,

we are developing applications / tools with ArcSDE C-API - and got hit by an "old" problem again.
since ArcSDE 9.2? - SE_stream_calculate_layer_extent stopped working - with the errorcode SE_INVALID_PARAM_VALUE. (the trace logs don't tell much to give me a hint what parameter may be wrong, because it worked until ArcSDE 9.1.)
I have only found this thread in the old forum - but no final answer to it:
http://forums.esri.com/Thread.asp?c=158&f=2289&t=297835


Since ArcSDE 9.2 we used "SE_log_calculate_extent" as a workaround to get the extend of the selected features. But since the introduction of the ST_GEOMETRY as storage type this also stopped working - with an SE_INVALID_WHERE error.

As far we have found out the problem is not our where criteria - the statements which are build by ArcSDE Service seem to be wrong - in the ArcSDE log I have found the following entries for two different tests I have done.

[Wed Aug 25 11:22:02 2010] [8530] [tng3] ENVP_sqlstmt: SELECT /*+ LEADING INDEX(SCHMITT.SDE_logfile_data SCHMITT.SDE_LOGFILE_DATA_IDX1) INDEX(SCHMITT.SDE_logfile_data SCHMITT.SDE_LOGFILE_DATA_IDX2) * / MIN(a.SHAPE.minx), MIN(a.SHAPE.miny), MAX(a.SHAPE.maxx), MAX(a.SHAPE.maxy), MIN(a.SHAPE.minz), MAX(a.SHAPE.maxz) FROM  (SELECT DISTINCT logfile_data_id, sde_row_id FROM SCHMITT.SDE_logfile_data WHERE SCHMITT.SDE_logfile_data.logfile_data_id = :lf_data_id) LF_, SCHMITT.SDE_TEST a where  ( LF_.logfile_data_id = :lf_data_id and   LF_.sde_row_id = SDE_TEST.OBJECTID  ) and  a.SHAPE.entity != 0 and a.SHAPE.numpts != 0
[Wed Aug 25 11:22:02 2010] [8530] [tng3] SDE_Oracle Error: 904  ORA-00904: "SDE_TEST"."OBJECTID": ungültiger Bezeichner (invalid identifier)


here it seems "SDE_TEST.OBJECTID" must be replaced with "a.OBJECTID" then it will be ok? 


depending on what target type of log we are useing - it results into different errors like this one.

[Wed Aug 25 11:28:39 2010] [8531] [tng3] ENVP_sqlstmt: SELECT /*+ LEADING INDEX(SCHMITT.SDE_logfile_data SCHMITT.SDE_LOGFILE_DATA_IDX1) INDEX(SCHMITT.SDE_logfile_data SCHMITT.SDE_LOGFILE_DATA_IDX2) * / MIN(a.SHAPE.minx), MIN(a.SHAPE.miny), MAX(a.SHAPE.maxx), MAX(a.SHAPE.maxy), MIN(a.SHAPE.minz), MAX(a.SHAPE.maxz) FROM  (SELECT DISTINCT logfile_data_id, sde_row_id FROM SCHMITT.SDE_logfile_data WHERE SCHMITT.SDE_logfile_data.logfile_data_id = :lf_data_id) LF_, SCHMITT.SDE_TEST a where  ( LF_.logfile_data_id = :lf_data_id and  LF_.sde_row_id = SHAPE.fid) and  a.SHAPE.entity != 0 and a.SHAPE.numpts != 0
      [Wed Aug 25 11:28:39 2010] [8531] [tng3] SDE_Oracle Error: 904  ORA-00904: "SHAPE"."FID": ungültiger Bezeichner


here it seems "SDE_SHAPE.FID" must be also replaced with "a.OBJECTID" then it will be ok?


---
I have attached a Q&D Sample program as sourcefile - for this you will need a simple feature class with objectid and a spatial column (shape) - the geometrytype of the feature class doesn't matter.



Is this a known issue?
Is there a work around I haven't found yet?

with best regards

A. Weber

--
ArcSDE 9.3.1 SP2  (32bit)
Oracle 10.2.0.4     (64-bit on Windows 2008 Server 64-bit)
(we are useing dbinit.sde LOCAL= to establish the connection between ArcSDE and Oracle
- running on the same host)
Client SDE Libraries and Server Libraries are in sync - Same Versions.
0 Kudos
1 Reply
VinceAngelo
Esri Esteemed Contributor
It can't be a known issue until an incident is filed with Tech Support.  Unfortunately,
it's now too late to get the fix(es) into 9.3.1 SP2 or 10.0 SP1.

It won't be as efficient as a server-side function, but you can write your own helper
to fetch all the shapes meeting your critera, then return the envelope.  Be sure to
pass in *only* the geometry column --

se_layer_calculate_extent(SE_CONNECTION conn, char *table, char *column, char *where,
                SE_ENVELOPE *e, LFLOAT zrange[2], LFLOAT mrange[2])

Note that this is close enough to  SE_layer_calculate_extent that you can try this
function as well.

If you're using ST_GEOMETRY, then there's probably a pure SQL call which will return
the union of the shape envelopes for a where clause (which would be less expensive
than the current SE_stream_calculate_layer_extent). 

ArcSDE 10.0 has a new SE_EXTENT_STATS_QUERY object API, but no documentation,
so it may not be implemented yet.

- V
0 Kudos