Mobile.Geodatabase Table as a featureTable for FeatureFenceParameters

102
2
Jump to solution
06-15-2022 12:19 AM
ECarson
New Contributor II

Hi All,

I'm trying to make a FeatureFenceParameters from a Mobile.Geodatabase for a Geotrigger. Everything loads however the trigger does not work as expected. Everything works fine if the featureTable for  FeatureFenceParameters is built from a ServiceFeatureTable.

I'm unsure how to correctly initiate a FeatureLayer from a Mobile.Geodatabase that will work for  FeatureFenceParameters featureTable? 

Any help is appreciated.

//FeatureLayer {
// ServiceFeatureTable {
// id: fT
// url: "https://..."
// definitionExpression: "STATUS IN ('Exists')"
// }
//}

FeatureLayer {
id: ft
featureTable: gdb.geodatabaseFeatureTablesByTableName["ThisTable"] ? gdb.geodatabaseFeatureTablesByTableName["ThisTable"] : null
definitionExpression: "STATUS IN ('Exists')"
}

FeatureFenceParameters {
id: fFP
featureTable: fT.featureTable
//featureTable: fT ---- Error: Unable to assign QmlFeatureLayer to QmlFeatureTable
//featureTable: gdb.geodatabaseFeatureTablesByTableName["ThisTable"] ? gdb.geodatabaseFeatureTablesByTableName["ThisTable"] : null ---- Does not produce anything
bufferDistance: 50
}

GeotriggerMonitor {
id: geotriggerMonitor
geotrigger: FenceGeotrigger{
feed: LocationGeotriggerFeed {
locationDataSource: simulatedLocationdataSource
}
ruleType: Enums.FenceRuleTypeEnterOrExit
fenceParameters: fFP
}

// Handle notification events
onGeotriggerNotification: {
if (geotriggerNotificationInfo.fenceNotificationType === Enums.FenceNotificationTypeEntered) {
entry();
} else{
exit();
}
}
Component.onCompleted: {
// Start monitoring Geotrigger event.
console.log("GeotriggerMonitor: Start monitoring!");
geotriggerMonitor.start();
}
}

0 Kudos
1 Solution

Accepted Solutions
TrevorFrame
Esri Contributor

Hi @ECarson,

In your GeotriggerMonitor{}, add an onWarningChanged signal handler to console any warnings. These warnings are pretty descriptive and helped me setup a Geotrigger Monitor with the Feature Layer (Geodatabase) sample we have. You can setup something like: 

onWarningChanged: {
     console.log(`Status code: ${status}... Warning message: ${warning.additionalMessage}`)
}

 

Using this, I found the featureTable the geotrigger monitor is monitoring isn't valid at time of start. What I ended up doing was creating a global property to track the geodatabase feature table.

property var geoDb: null

 

In the Geodatabase component, I setup a the onGeodatabaseFeatureTablesChanged signal handler to set the geodatabase feature table property and started the simulatedLocationdataSource and geotrigger monitor. I did this to ensure the feature table is retrieved before starting the geotrigger monitor. 

Geodatabase {
     id: gdb
     path: AppFramework.resolvedPathUrl(copyLocalData(inputGDB, outputGDB))
     onGeodatabaseFeatureTablesChanged: {
          geoDb = geodatabaseFeatureTables[0]
          simulatedLocationdataSource.start()
          geoTrigger.start()
     }
}

 

Best,

Trevor

View solution in original post

0 Kudos
2 Replies
TrevorFrame
Esri Contributor

Hi @ECarson,

In your GeotriggerMonitor{}, add an onWarningChanged signal handler to console any warnings. These warnings are pretty descriptive and helped me setup a Geotrigger Monitor with the Feature Layer (Geodatabase) sample we have. You can setup something like: 

onWarningChanged: {
     console.log(`Status code: ${status}... Warning message: ${warning.additionalMessage}`)
}

 

Using this, I found the featureTable the geotrigger monitor is monitoring isn't valid at time of start. What I ended up doing was creating a global property to track the geodatabase feature table.

property var geoDb: null

 

In the Geodatabase component, I setup a the onGeodatabaseFeatureTablesChanged signal handler to set the geodatabase feature table property and started the simulatedLocationdataSource and geotrigger monitor. I did this to ensure the feature table is retrieved before starting the geotrigger monitor. 

Geodatabase {
     id: gdb
     path: AppFramework.resolvedPathUrl(copyLocalData(inputGDB, outputGDB))
     onGeodatabaseFeatureTablesChanged: {
          geoDb = geodatabaseFeatureTables[0]
          simulatedLocationdataSource.start()
          geoTrigger.start()
     }
}

 

Best,

Trevor

0 Kudos
ECarson
New Contributor II

Thanks for the the reply Trevor, this certainly worked.

I wasn't able to figure out how to apply a definition expression on the feature table before applying it to the FeatureFenceParamters or apply a whereclause within. I just had a feature table in the mobile geodatabase with only the features I wanted.

If anyone has a an idea about this additional solution it would be great.

Regards,

Elliott

0 Kudos