Hi, Could anyone suggest a potential work around ref enabling multiple locationDataSources to feed seperate Geofences. I have no issues creating a single fence and can define the monitor type no issue. I tried a couple of things. (Please forgive my current rough code) such as feeding the loactionDataSource directly. Creating different fences based on the name. The issue appears to be the singular loactionDataSource. Is there a way to enable multiple? (Java SDK 200.6 )
// This is being feed from the Dynamic entity data. (ESRI Realtime) The same data which populates the symbology on the screen
public void dataInput(Point latestPoint, HashMap<String, Object> attributes) {
this.latestPoint = latestPoint;
// Each latestPoint can be associated with an attribute. I want to create a different location data source for each attribute type
//I also considered the GeodataBase as a source
String uniquedesignation = (String) attributes.get("uniquedesignation");
//Given I am using Military Symbology 2525D I can determine the identity (Friendly, Hostile etc) I could also use the uniquedesignation
String sidc = (String) attributes.get("sidc");
String firstFour = (sidc != null) ? sidc.substring(0, Math.min(sidc.length(), 4)) : "";
if (monitor!=null) {
if (firstFour.equals(getMonitoringCategory(monitor)) || getMonitoringCategory(monitor).equals(uniquedesignation)) {
updateLocation(new Location(latestPoint));
}
}
}
//This is an SQLite database not the GeoDatabase
public void dataBaseOutput(String id, String theFence, String name, String monitor, String trigger, String bufferDistance, String enableMonitor) {
this.mapView = ui.getMapView();
this.name = name;
this.monitor=monitor;
this.bufferDistance=bufferDistance;
try {// Recreate the Graphic from the geometry json file
Geometry fenceGeometry = Geometry.fromJson(theFence);
Graphic fence = new Graphic(fenceGeometry);
//Reinsert the attributes. Maybe don't need to but have done so at this stage
fence.getAttributes().put("id", id);
fence.getAttributes().put("name", name);
//Add the fence graphic to a list
fences.add(fence);
//I wanted to be able to make different fences
GraphicFenceParameters selectedFenceParams = getFenceParametersForCategory(name,bufferDistance);
if (selectedFenceParams != null) {
updateFenceMonitoring(selectedFenceParams);
}
//Need to fix this
if ("1".equals(enableMonitor)) {
getMonitoringCategory(monitor);
startGeotriggerMonitoring(fence, monitor, trigger, bufferDistance);
}
} catch (Exception e) {
LOG.error("Error parsing fence geometry JSON", e);
}
}
I sorted it out. It was my lack of knowledge. I now can set as many fences as I like on any feed
Hi Rodney!
Glad you figured it out. FYI- we are planning to start the work to integrate Dynamic Entities as a feed type to Geotriggers this year.
Is your use case that you have one DynamicEntityDataSource for all identities (friendly and enemy), and you would like to have separate Geotriggers configured with different fences based on identity? So basically if you could filter your DynamicEntityDataSource based on attribute and use that as an input feed to a FenceGeotrigger (with its own source for fences), that would be ideal for you?
Kerry
HI Kerry, In short yes. I currently have the following inputs: All, Enemy(1003 from SIDC), Hostile (1006), Neutral (1004) and Custom based upon the uniquedesignation. I am feeding the data from the DynamicEntityDataSource . I had to create an abstract class CustomLocationDataSource extends LocationDataSource implements GeotriggerMonitorNotificationEventListener from this I had to create seperate classes for each of the filter class types eg class FriendlyDataSource extends CustomLocationDataSource implements GeotriggerMonitorNotificationEventListener each class was feed updateLocation(new LocationDataSource.Location(point)); As I am a slow learner it took me awhile to figure out silly things like, not feeding the mapView as I only wanted my symbology, using updateLocation(new LocationDataSource.Location(point)); and how to turn the feed off and on again cleanly. In fact it took me awhile to figure out how to have multiple LocatDataSources just generally.