'check if point in On route or near route GeoTools
I have assetRoute_TB collection in the mongoDb in which i have set coordinates for the route of the vehicle, now i have point of the moving vehicle meaning point(lat lng) and i need to check if the point is on route or near route like in radius of 1 mile, in the listed Aggregation i am extracting the route coordinates from the SourceWayPoint Array by using Object id of the document that match the vechile route.
public boolean withInSource(MongoCollection<Document> assetRouteCollection, Double latitude, Double longitude, ArrayList<String> objectIds ){
for (String object : objectIds) {
ProjectionOperation Project = project("SourceWayPoint");
Aggregation Ags = newAggregation(
match(Criteria.where("_id").is(object)),
Project);
MongoAssetRoute route = mongoTemplate.aggregate(Ags,"AssetRoute_TB",MongoAssetRoute.class).getUniqueMappedResult();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
