Access data attributes from SceneLayer in ArcGIS Runtime Android 100.2 ?
See original GitHub issueFeature or Bug?
This a Sample request?
Behavior
I noticed that we can access data attributes from layers (SceneLayer with multipatch geometries) with javascript api 4.6.
but how to highlight the object and access data attributes from layers in ArcGIS Runtime Android and iOS? We tested setOnTouchListener API with 100.2 version, and it not works on sceneLayer for multipatch geometries. and i have make an issue on Geonet, and found the relational issues issue1 with no response on Geonet
the code segment i use is as follow:
@ReactMethod
public void initializeSDK(final Promise promise) {
try {
ArcGISScene scene = new ArcGISScene();
scene.setBasemap(Basemap.createImagery());
mSceneView.setScene(scene);
mSceneView.setOnTouchListener(new DefaultSceneViewOnTouchListener(mSceneView) {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
float x = motionEvent.getX();
float y = motionEvent.getY();
double tolerance = 20.0;
android.graphics.Point point = new android.graphics.Point(Math.round(x), Math.round(y));
final ListenableFuture<List<IdentifyLayerResult>> featureResult = mSceneView.identifyLayersAsync(point, tolerance, true);
featureResult.addDoneListener(new Runnable() {
@Override
public void run() {
try {
List<IdentifyLayerResult> lstfeature = featureResult.get();
Log.i(REACT_CLASS, "feature length:" + lstfeature.size());
for (int i = 0; i < lstfeature.size(); i++) {
IdentifyLayerResult feature = lstfeature.get(i);
List<GeoElement> lstGeo = feature.getElements();
Log.i(REACT_CLASS, "layer:" + feature.getLayerContent().getName());
Log.i(REACT_CLASS, "Geo length:" + lstGeo.size());
for (int j = 0; j < lstGeo.size(); j++) {
Map<String, Object> mapFeature = lstGeo.get(j).getAttributes();
}
}
} catch (InterruptedException e) {
e.printStackTrace();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
});
return super.onTouch(view, motionEvent);
}
});
WritableMap params = Arguments.createMap();
params.putString("status", "success");
promise.resolve(params);
} catch (Exception ex) {
Log.e(REACT_CLASS, ex.toString());
promise.reject(ex.getMessage());
}
}
/***
* openProject
*
* @param mapParams
* @param successCallback
* @param errorCallback
*/
@ReactMethod
public void openProject(ReadableMap mapParams, final Callback successCallback, final Callback errorCallback) {
try {
// DOM
ReadableArray arr_DOM = mapParams.getArray("DOM");
for (int i = 0; i < arr_RMX_DOM.size(); i++) {
ReadableMap map_DOM = arr_DOM.getMap(i);
ArcGISTiledLayer layer_DOM = new ArcGISTiledLayer(map_DOM.getString("url"));
layer_DOM.setName(map_DOM.getString("title"));
mSceneView.getScene().getOperationalLayers().add(layer_DOM);
}
// Terrain
ReadableArray arr_Terrain = mapParams.getArray("Terrain");
for (int j = 0; j < arr_Terrain.size(); j++) {
ReadableMap map_Terrain = arr_Terrain.getMap(j);
ArcGISTiledElevationSource elevationSource_Terrain = new ArcGISTiledElevationSource(map_Terrain.getString("url"));
mSceneView.getScene().getBaseSurface().getElevationSources().add(elevationSource_Terrain);
}
// Model
ReadableArray arr_Model = mapParams.getArray("Model");
for (int j = 0; j < arr_Model.size(); j++) {
ReadableMap map_Model = arr_Model.getMap(j);
ArcGISSceneLayer sceneLayer = new ArcGISSceneLayer(map_Model.getString("url"));
sceneLayer.setName(map_Model.getString("title"));
mSceneView.getScene().getOperationalLayers().add(sceneLayer);
}
// initialize camera
Camera camera = new Camera(29.011088139925707, 103.88570908840268, 457.09098537638783, 325.8343841906436, 59.5289549838569, 0.0);
mSceneView.setViewpointCamera(camera);
// success
successCallback.invoke("success");
} catch (Exception ex) {
Log.e(REACT_CLASS, ex.toString());
// error
errorCallback.invoke(ex.toString());
}
}
so how can we to get atrribult from the multipatch geometries and make it highlight ?
thanks a lot
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to access data attributes from layers and grap...
How to access data attributes from layers and graphics in ArcGIS Runtime Android ... api with 100.2 version. and it not works on...
Read more >Feature layer show attributes | ArcGIS Runtime API for Android
Return all loaded features from a query to show all attributes. Feature Layer Show Attributes App. Use case. Attributes can be used to...
Read more >Migrate to 100.x from 10.2.x | ArcGIS Runtime API for .NET
Use the latest version of ArcGIS Runtime API for .NET to build apps that incorporate capabilities such as mapping, geocoding, routing, and spatial...
Read more >Scene layer | ArcGIS Runtime API for Android
About the data. The scene launches with a northward view of the city of Brest, France. A 3D scene layer representing buildings (some...
Read more >Viewshed (ArcGIS Runtime SDK for Android 100.15.0)
Viewshed analysis is reactive - whenever data changes (such as change in scene layer load status or visibility), the viewshed will automatically update....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hi @zj8487 . We are planning on releasing 100.3 a week or so before the User Conference. should be end of June.
Hi, @eri9600, That sounds great, if there is a preview version is more great! we are blocked on the issue more than half years.