mirror of
https://github.com/FoggedLens/deflock.git
synced 2026-05-26 01:07:49 +02:00
primitive clustering, cache nominatim
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
import axios from "axios";
|
||||
|
||||
export interface Cluster {
|
||||
id: string;
|
||||
lat: number;
|
||||
lon: number;
|
||||
}
|
||||
|
||||
export interface BoundingBoxLiteral {
|
||||
minLat: number;
|
||||
maxLat: number;
|
||||
@@ -20,6 +26,10 @@ export class BoundingBox implements BoundingBoxLiteral {
|
||||
this.maxLng = maxLng;
|
||||
}
|
||||
|
||||
containsPoint(lat: number, lng: number) {
|
||||
return lat >= this.minLat && lat <= this.maxLat && lng >= this.minLng && lng <= this.maxLng;
|
||||
}
|
||||
|
||||
updateFromOther(boundingBoxLiteral: BoundingBoxLiteral) {
|
||||
this.minLat = boundingBoxLiteral.minLat;
|
||||
this.maxLat = boundingBoxLiteral.maxLat;
|
||||
@@ -55,6 +65,12 @@ export const getALPRs = async (boundingBox: BoundingBox) => {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const getClusters = async () => {
|
||||
const s3Url = "https://deflock-clusters.s3.us-east-1.amazonaws.com/alpr_clusters.json";
|
||||
const response = await apiService.get(s3Url);
|
||||
return response.data;
|
||||
}
|
||||
|
||||
export const geocodeQuery = async (query: string, currentLocation: any) => {
|
||||
const encodedQuery = encodeURIComponent(query);
|
||||
const results = (await apiService.get(`/geocode?query=${encodedQuery}`)).data;
|
||||
|
||||
Reference in New Issue
Block a user