Vehicle monitoring project records vehicle GPS positioning data. When we inspected highways in Zhejiang Province, the GPS heat map showed that the result became like this, as shown in the picture:
In MongoDB, the format for storing data is as follows
{
"_id" : ObjectId("593e58b8d1eece32080d6632"),
"x" : 121.494230074275,
"y" : 29.6998736880818
}
After passing the query, the json format returned is as follows:
{"lng":"121.98826732480999624","lat":"29.88628748150999925","count":1},{"lng":"122.00810540175000085","lat":"29.82699952501900142", "count":1} ,{"lng":"122.00148151521000273","lat":"29.82556419141700133","count":1},{"lng":"122.09566082377000384","lat":"29.86581727309599898"," count":1},{ "lng":"121.99538599286999840","lat":"29.82299558164600128","count":1},{"lng":"121.98481996031999586","lat":"29.81670171825599880","count": 1},{"lng ":"121.97925141116000702","lat":"29.81335324424399857","count":1},{"lng":"121.96654822066000179","lat":"29.80203305154499915","count":1}, {"lng": "121.96121962927000482","lat":"29.79876428024099866","count":1},{"lng":"121.94649301222000304","lat":"29.79243430893799882","count":1},{" lng":"121.94300499519999903 ","lat":"29.79132642105500040","count":1},{"lng":"121.93624256578000598","lat":"29.79261412193099900","count":1},{"lng":"121.9297634540100 0060", "lat":"29.79086531288499984","count":1},{"lng":"121.91419359308000026","lat":"29.78270234553000151","count":1}
Excuse me, is there any query method that can aggregate the data of a point and get the query result, that is, the subsequent count value is the aggregated value. I think it is similar to the group by in mysql, but this is not simple. group by, I don’t know what the solution is
PHP中文网2017-06-14 10:56:45
My personal understanding is that one idea is to divide many areas in the map and count the number of positions ($geowithin) falling in each area.
For reference.
Love MongoDB! Have fun!