spatialReferenceによる血液事件
実装機能:QueryTaskのようなボックスクエリ
ネイティブ環境:ArcGIS Server 10.0、FlexViewer 2.4
正式環境:ArcGIS Server 9.3、FlexViewer 2.4
コード:
これにより本機環境ではエラーは発生しないが、本環境ではエラーメッセージ:[RPC Fault faultString="Cannot perform query.Invalid query parameters.]faultCode="500"faultDetail="inSR param is invalid:{"wkt":"PROJCS[XiAn80],GEOGCS[XiAn80],DATUM[D_XiAn_1980],SPHEROID[GRS_1800_China],6378140.0140.01400.298.257],PRIMEM[Greenwich],0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",117.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"}"]
空間参照の問題に起因し、最終的な解決方法:コードは次のとおりです.
ネイティブ環境:ArcGIS Server 10.0、FlexViewer 2.4
正式環境:ArcGIS Server 9.3、FlexViewer 2.4
コード:
// graphicsExtent
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
var query2:Query = new Query();
query2.returnGeometry = true;
query2.geometry = graphicsExtent.extent;
query2.outSpatialReference = map.spatialReference;
var queryTask:QueryTask = new QueryTask();
queryTask.url = logicMapQueryAddress2;
queryTask.useAMF = false;
queryTask.showBusyCursor = true;
queryTask.execute(query2, new AsyncResponder(onResul2, onFault2));
function onResul2(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length == 0)
{
Alert.show("Please try again.");
}
else
{
trace(featureSet.features);
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
map.extent = graphicsExtent.expand(1.5);
globalCache.putData("initExtent",graphicsExtent);
}
mapExtentLock.lock(map);
}
function onFault2(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
}
これにより本機環境ではエラーは発生しないが、本環境ではエラーメッセージ:[RPC Fault faultString="Cannot perform query.Invalid query parameters.]faultCode="500"faultDetail="inSR param is invalid:{"wkt":"PROJCS[XiAn80],GEOGCS[XiAn80],DATUM[D_XiAn_1980],SPHEROID[GRS_1800_China],6378140.0140.01400.298.257],PRIMEM[Greenwich],0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Gauss_Kruger\"],PARAMETER[\"False_Easting\",500000.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",117.0],PARAMETER[\"Scale_Factor\",1.0],PARAMETER[\"Latitude_Of_Origin\",0.0],UNIT[\"Meter\",1.0]]"}"]
空間参照の問題に起因し、最終的な解決方法:コードは次のとおりです.
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
if (graphicsExtent)
{
[b]var xmi:Number = graphicsExtent.extent.xmin;
var ymi:Number = graphicsExtent.extent.ymin;
var xma:Number = graphicsExtent.extent.xmax;
var yma:Number = graphicsExtent.extent.ymax;
var newExtent:Extent = new Extent(xmi,ymi,xma,yma);[/b]
var query2:Query = new Query();
query2.returnGeometry = true;
[b]query2.geometry = newExtent.extent;[/b]
var queryTask:QueryTask = new QueryTask();
queryTask.url = logicMapQueryAddress2;
queryTask.useAMF = false;
queryTask.showBusyCursor = true;
queryTask.execute(query2, new AsyncResponder(onResul2, onFault2));
function onResul2(featureSet:FeatureSet, token:Object = null):void
{
if (featureSet.features.length == 0)
{
Alert.show("Please try again.");
}
else
{
trace(featureSet.features);
var graphicsExtent:Extent = GraphicUtil.getGraphicsExtent(featureSet.features);
map.extent = graphicsExtent.expand(1.5);
globalCache.putData("initExtent",graphicsExtent);
}
mapExtentLock.lock(map);
}
function onFault2(info:Object, token:Object = null):void
{
Alert.show(info.toString());
}
}