Remove direct calls to stadia API from geocoding
This commit is contained in:
parent
43dce16fbd
commit
9ef6aaa406
20 changed files with 213 additions and 274 deletions
|
|
@ -279,28 +279,32 @@ function updateMap() {
|
|||
let max = loc;
|
||||
|
||||
for (const i of selectedCommunication.value?.public_report?.images ?? []) {
|
||||
if (i.location != null && i.location.lat != 0 && i.location.lng != 0) {
|
||||
if (
|
||||
i.location != null &&
|
||||
i.location.latitude != 0 &&
|
||||
i.location.longitude != 0
|
||||
) {
|
||||
mapMarkers.value.push({
|
||||
color: "#00FF00",
|
||||
draggable: false,
|
||||
id: new Date().toISOString(),
|
||||
location: i.location,
|
||||
});
|
||||
min.lat = Math.min(min.lat, i.location.lat);
|
||||
min.lng = Math.min(min.lng, i.location.lng);
|
||||
max.lat = Math.max(max.lat, i.location.lat);
|
||||
max.lng = Math.max(max.lng, i.location.lng);
|
||||
min.latitude = Math.min(min.latitude, i.location.latitude);
|
||||
min.longitude = Math.min(min.longitude, i.location.longitude);
|
||||
max.latitude = Math.max(max.latitude, i.location.latitude);
|
||||
max.longitude = Math.max(max.longitude, i.location.longitude);
|
||||
}
|
||||
}
|
||||
|
||||
mapBounds.value = {
|
||||
max: {
|
||||
lat: max.lat + 0.01,
|
||||
lng: max.lng + 0.01,
|
||||
latitude: max.latitude + 0.01,
|
||||
longitude: max.longitude + 0.01,
|
||||
},
|
||||
min: {
|
||||
lat: min.lat - 0.01,
|
||||
lng: min.lng - 0.01,
|
||||
latitude: min.latitude - 0.01,
|
||||
longitude: min.longitude - 0.01,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ import ThreeColumn from "@/components/layout/ThreeColumn.vue";
|
|||
import TimeRelative from "@/components/TimeRelative.vue";
|
||||
import { useSignalStore } from "@/store/signal";
|
||||
import { useSessionStore } from "@/store/session";
|
||||
import { Lead, Location, Point, Signal } from "@/types";
|
||||
import { Lead, Point, Signal } from "@/types";
|
||||
import type { Location } from "@/type/api";
|
||||
|
||||
// Refs
|
||||
const mapTile = ref(null);
|
||||
|
|
@ -110,29 +111,6 @@ function doSendToOperations() {
|
|||
function doSplitLead() {
|
||||
console.log("doSplitLead");
|
||||
}
|
||||
// Helper functions (outside component)
|
||||
const getBoundingBox = (points: Location[]) => {
|
||||
if (!points || points.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let minLat = points[0].lat;
|
||||
let maxLat = points[0].lat;
|
||||
let minLng = points[0].lng;
|
||||
let maxLng = points[0].lng;
|
||||
|
||||
for (const point of points) {
|
||||
if (point.lat < minLat) minLat = point.lat;
|
||||
if (point.lat > maxLat) maxLat = point.lat;
|
||||
if (point.lng < minLng) minLng = point.lng;
|
||||
if (point.lng > maxLng) maxLng = point.lng;
|
||||
}
|
||||
|
||||
return new window.maplibregl.LngLatBounds(
|
||||
new window.maplibregl.LngLat(minLng, minLat),
|
||||
new window.maplibregl.LngLat(maxLng, maxLat),
|
||||
);
|
||||
};
|
||||
const markers = computed(() => {
|
||||
return [];
|
||||
});
|
||||
|
|
@ -151,7 +129,7 @@ const updateMap = (signals: Signal[]) => {
|
|||
new window.maplibregl.Marker({
|
||||
color: "#FF0000",
|
||||
draggable: false,
|
||||
}).setLngLat([l.lng, l.lat]),
|
||||
}).setLngLat([l.longitude, l.latitude]),
|
||||
);
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -102,11 +102,11 @@ import {
|
|||
Bounds,
|
||||
Changes,
|
||||
Contact,
|
||||
Location,
|
||||
MapClickEvent,
|
||||
Marker,
|
||||
ReviewTask,
|
||||
} from "@/types";
|
||||
import type { Location } from "@/type/api";
|
||||
|
||||
interface FormData {
|
||||
latitude: number;
|
||||
|
|
@ -147,7 +147,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|||
|
||||
// State
|
||||
const newPoolCondition = ref<string>("");
|
||||
const newPoolLocation = ref<Location>({ lat: 0, lng: 0 });
|
||||
const newPoolLocation = ref<Location>({ latitude: 0, longitude: 0 });
|
||||
const newOwnerName = ref<string>("");
|
||||
const newResidentName = ref<string>("");
|
||||
const error = ref<string | null>(null);
|
||||
|
|
@ -186,12 +186,12 @@ const changes = computed<Changes>(() => {
|
|||
} else {
|
||||
unchanged.push("condition");
|
||||
}
|
||||
if (newPoolLocation.value.lat != pool.site.location.lat) {
|
||||
if (newPoolLocation.value.latitude != pool.site.location.latitude) {
|
||||
updated.push("latitude");
|
||||
} else {
|
||||
unchanged.push("latitude");
|
||||
}
|
||||
if (newPoolLocation.value.lng != pool.site.location.lng) {
|
||||
if (newPoolLocation.value.longitude != pool.site.location.longitude) {
|
||||
updated.push("longitude");
|
||||
} else {
|
||||
unchanged.push("longitude");
|
||||
|
|
@ -260,14 +260,14 @@ function updateMap(task: ReviewTask): void {
|
|||
new maplibregl.Marker({
|
||||
color: "#FF0000",
|
||||
draggable: false,
|
||||
}).setLngLat([loc.lng, loc.lat]),
|
||||
}).setLngLat([loc.longitude, loc.latitude]),
|
||||
];
|
||||
|
||||
map.SetMarkers(markers);
|
||||
|
||||
const bounds = new maplibregl.LngLatBounds(
|
||||
new maplibregl.LngLat(loc.lng - 0.005, loc.lat - 0.005),
|
||||
new maplibregl.LngLat(loc.lng + 0.005, loc.lat + 0.005),
|
||||
new maplibregl.LngLat(loc.longitude - 0.005, loc.latitude - 0.005),
|
||||
new maplibregl.LngLat(loc.longitude + 0.005, loc.latitude + 0.005),
|
||||
);
|
||||
|
||||
map.FitBounds(bounds, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue