私はEsri ArcGis Js Api v3.11を使ってマップサービスを持っています。マップとレイヤーのwkidが異なる場合、フィーチャー選択をズームするにはどうすればいいですか?
このマップでは、すべてのFeatureLayerをクエリでき、単純なグリッドが返されます。クエリと、それが結果にズーム、正常に動作している周りのすべてのものは私に頭痛を与えている間
_grid.on('dgrid-select', function(event) {
var data = event.rows[0].data;
//get the current selected featureLayer
//build a query against it, using the objectId
//zoom to position: https://developers.arcgis.com/javascript/3/jssamples/fl_zoomgrid.html
var layerUrl = dijit.byId("LayerSelectBox").get("value");
var url = lang.replace(_baseUrl, { layer: layerUrl });
var fl = new FeatureLayer(url, {
mode: FeatureLayer.MODE_SELECTION,
outFields: ["ObjectID"]
});
//clear selection
fl.clearSelection();
query.objectIds = [data.OBJECTID];
fl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(features) {
//zoom to the selected feature
var geometryExtent = features[0].geometry.getExtent().expand(5.0);
_map.setExtent(geometryExtent);
});
});
:行のクリックイベントは、添付の次のハンドラを持っています。マップは、102100の空間参照WKID、102362.
の戻りジオメトリがジオメトリのものに地図の範囲を設定しようとまたはfollwingエラーの点結果に中心があります
Map: Geometry (wkid: 102362) cannot be converted to spatial reference of the map (wkid: 102100)
.selectFeatures
から
ドキュメント(https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#selectfeaturesは)のみ有用な情報のこのビットを提供しています:
The input query. The query object has the following restrictions to avoid conflicts between layer and map properties.
- outFields specified by the query object are overridden by the outFields specified in the FeatureLayer constructor.
- The returnGeometry value specified by the query object is ignored and true is used.
- The outSpatialReference set by the query object is ignored and the map's spatial reference is used.
正直に言うと、私は少しconfuesesいます。結果srをマップsrに変換/変換し、そのマップを中心にするにはどうすればよいですか? FeatureLayerをマップ上でクリックしてクエリを実行すると、小さなダイアログウィンドウが表示され、すぐにズームボタンが表示されるので、グラブの機能がそこにあります。私は根本的に何かをやっているようだ。私は、ジオメトリの集合から範囲を計算するgraphicUtilsを使用しています
fl.selectFeatures(query, FeatureLayer.SELECTION_NEW, function(features) {
var gmsvc = new GeometryService("url//to/Geometryservice");
var fooExtent = graphicUtils.graphicsExtent(features);
var projectParams = new ProjectParameters();
projectParams.geometries = [fooExtent];
projectParams.outSR = map.spatialReference;
gmsvc.project(projectParams).then(function(x) {
map.setExtent(x[0]);
})
});
:最後に