I need connect featuretable and layer to programm on QML,
Geodatabase{ id:gdb path: "C:/Qt/prjcts/2nd.geodatabase" } Map{ id: map ArcGISLocalTiledLayer{ id:floor2 path: "C:/Qt/prjcts/2nd.tpk" } GeodatabaseFeatureTable{ id: gdbtable geodatabase: gdb featureServiceLayerName: "a2" } FeatureLayer { id: featureLayer featureTable: gdbtable selectionColor: "cyan" } }
Solved! Go to Solution.
Hi Nick,
If you use just the code I sent without the tpk, it works. Once you add the TPK, it doesn't work. This is because your TPK is in spatial ref 102100, while your gdb is in 2610. We don't support on the fly auto reprojection with the offline gdb, so when you are clicking on what looks like your feature layer, you are actually just clicking on the TPK, and the gdb isn't actually displaying on your screen.
Since the map's spatial reference is defined by the first layer added to it, you have a couple options:
1) Create your TPK in 2610 instead of 102100 (web mercator). This would require you to create the necessary tiling scheme in ArcMap as opposed to using the AGOL/Bing/Google tiling scheme, which makes it 102100. Once you have your TPK in the correct spatial reference, the geodatabase that is in that spatial reference will display as expected
2) Continue using the TPK that is in 102100, and re-create your geodatabase in 102100 instead of 2610. If you are creating the geodatabase from an online feature service, you can pass the desired spatial reference into the sync parameters. If you are creating it from ArcMap, you can change the data frame's spatial reference to 102100.
Hope this helps.
-Luke
(*accidentally sent)
.., i do this like this code. But programm don't finds featuretable, at least consider it empty..
How correctly connect feature table and layer to program?
Nick-
Your code looks good. Does the feature service layer name match "a2"? You can also try doing feature service layer index and specify the index instead of the name. If that doesn't work, can you attach a sample geodatabase?
Thanks,
Luke
Nick-
Give something like this a try:
import QtQuick 2.3 import QtQuick.Controls 1.2 import ArcGIS.Runtime 10.26 ApplicationWindow { id: appWindow width: 800 height: 600 Geodatabase { id:gdb path: "/Users/username/Desktop/second.geodatabase" } GeodatabaseFeatureTable{ id: gdbtable geodatabase: gdb featureServiceLayerId: 0 } Map { anchors.fill: parent focus: true FeatureLayer { id: featureLayer featureTable: gdbtable selectionColor: "cyan" } onMouseClicked: { var featureList = featureLayer.findFeatures(mouse.x,mouse.y,2,20) console.log("number of features:", featureList.length); for (var i = 0; i < featureList.length; i++) { console.log("feature id is:", featureList); } } } }
Hi Nick,
If you use just the code I sent without the tpk, it works. Once you add the TPK, it doesn't work. This is because your TPK is in spatial ref 102100, while your gdb is in 2610. We don't support on the fly auto reprojection with the offline gdb, so when you are clicking on what looks like your feature layer, you are actually just clicking on the TPK, and the gdb isn't actually displaying on your screen.
Since the map's spatial reference is defined by the first layer added to it, you have a couple options:
1) Create your TPK in 2610 instead of 102100 (web mercator). This would require you to create the necessary tiling scheme in ArcMap as opposed to using the AGOL/Bing/Google tiling scheme, which makes it 102100. Once you have your TPK in the correct spatial reference, the geodatabase that is in that spatial reference will display as expected
2) Continue using the TPK that is in 102100, and re-create your geodatabase in 102100 instead of 2610. If you are creating the geodatabase from an online feature service, you can pass the desired spatial reference into the sync parameters. If you are creating it from ArcMap, you can change the data frame's spatial reference to 102100.
Hope this helps.
-Luke
I am try to use this code for feature layer and its work
but I want to identify the fields from file geodatabase , but the attrbut qml is null
can help me ?