ArcGIS Js/Flex等前端API(Query(StatisticDefinition)时)针对SDE的SHAPE.AREA/SHAPE.LEN知道查询无效,而对GDB的SHAPE_Area/SHAPE_Length有效探索。
FIeld 'SHAPE.AREA' and 'SHAPE.LEN' of SDE For Oracle,Field 'SHAPE_Area' and 'SHAPE_Length' of gdb(geodatabase). The fields of GDB can be OK when QueryTask do query then outStatistics of query be setted.
1 require([ 2 "esri/tasks/query", "esri/tasks/StatisticDefinition", ... 3 ], function(Query, StatisticDefinition, ... ) { 4 var query = new Query(); 5 var statisticDefinition = new StatisticDefinition(); 6 statisticDefinition.statisticType = "sum"; 7 statisticDefinition.onStatisticField = "SHAPE_Area";//SHAPE.AREA failed, 8 statisticDefinition.outStatisticFieldName = "TotalArea"; 9 10 query.outStatistics = [statisticDefinition]; 11 ... 12 });
那么问题来了,每种关系数据库类型的几何针对面积和长度,我们做个分析:
类型 |
GDB(文件Geodatabase) |
Oracle |
PostgreSQL |
SqlServer |
面积 |
SHAPE_Area |
SHAPE.AREA |
Shape_Area |
SHAPE.STArea() |
长度 |
SHAPE_Length |
SHAPE.LEN |
Shape_Length |
SHAPE.STLength() |
几何 |
Geometry |
ST_GEOMETRY/ SDO_GEOMETRY |
简化Geometry(如box等) |
Geometry/ Geography |
针对ORACLE的图形计算面积长度字段采用SQL语法形式,用于普通SQL查询可以实现,如:【SHAPE.AREA>1000】;
GIS的API开发都会有针对SDE调用Oracle/SQLServer/PostgreSQL的SQL语句情况,笔者在Flex/JS开发时针对Query的outStatistics设置StatisticDefinition时,碰到给字段onStatisticField添加值时无法查询,查看最新API,下图:
JS的3系API为3.17,针对ArcGIS Server10.3部署服务,无【advancedQueryCapabilities】选项,而ArcGIS Online则有;4系API4.0目前与3系是2个不同序列,暂未详细研究,可能ArcGIS Server Portal支持。。
目前对此解决方法提议:对query的outStatistics不设置SHAPE.AREA字段,先做其他统计,需要面积的再做一次QueryTask条件查询。