map: show preview of coarse
parent
b7dcf4786a
commit
85f3d635c6
|
@ -60,8 +60,7 @@ class MapController extends ApiBase
|
||||||
$clusters = $this->timelineQuery->getMapClusters($gridLen, $bounds, $root);
|
$clusters = $this->timelineQuery->getMapClusters($gridLen, $bounds, $root);
|
||||||
|
|
||||||
// Merge clusters that are close together
|
// Merge clusters that are close together
|
||||||
$distanceThreshold = $gridLen / 2;
|
$clusters = $this->mergeClusters($clusters, $gridLen / 2);
|
||||||
$clusters = $this->mergeClusters($clusters, $distanceThreshold);
|
|
||||||
|
|
||||||
return new JSONResponse($clusters);
|
return new JSONResponse($clusters);
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
|
|
|
@ -47,8 +47,9 @@ trait TimelineQueryMap
|
||||||
->from('memories_map_clusters', 'c')
|
->from('memories_map_clusters', 'c')
|
||||||
;
|
;
|
||||||
|
|
||||||
if ($gridLen > 0.2) {
|
if ($gridLen > 0.02) {
|
||||||
// Coarse grouping
|
// Coarse grouping
|
||||||
|
$query->addSelect($query->createFunction('MAX(c.id) as id'));
|
||||||
$query->addGroupBy($query->createFunction("CAST(c.lat / {$gridLen} AS INT)"));
|
$query->addGroupBy($query->createFunction("CAST(c.lat / {$gridLen} AS INT)"));
|
||||||
$query->addGroupBy($query->createFunction("CAST(c.lon / {$gridLen} AS INT)"));
|
$query->addGroupBy($query->createFunction("CAST(c.lon / {$gridLen} AS INT)"));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -116,7 +116,7 @@ export default defineComponent({
|
||||||
|
|
||||||
zoomTo(center: [number, number]) {
|
zoomTo(center: [number, number]) {
|
||||||
const map = this.$refs.map as LMap;
|
const map = this.$refs.map as LMap;
|
||||||
const zoom = Math.max(map.mapObject.getZoom() + 2, 14);
|
const zoom = map.mapObject.getZoom() + 2;
|
||||||
map.mapObject.setView(center, zoom, { animate: true });
|
map.mapObject.setView(center, zoom, { animate: true });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue