changing pins

This commit is contained in:
Jesse Winton
2025-04-15 08:36:38 -04:00
parent e5917adc02
commit b42b05426c
2 changed files with 20 additions and 23 deletions

View File

@@ -5,11 +5,6 @@ type Coordinates = {
longitude: number;
};
type PixelPosition = {
x: number;
y: number;
};
export const latLongToSvgPosition = ({
latitude,
longitude,
@@ -19,10 +14,10 @@ export const latLongToSvgPosition = ({
const { west, east, north, south } = MAP_BOUNDS;
const lngRatio = (longitude - west) / (east - west);
const latRatio = (north - latitude) / (north - south);
const latRatio = (latitude - south) / (north - south);
const x = Math.max(0, Math.min(1, lngRatio)) * 100; // % instead of px
const y = Math.max(0, Math.min(1, latRatio)) * 100;
const x = Math.max(0, Math.min(1, lngRatio)) * 100;
const y = Math.max(0, Math.min(1, 1 - latRatio)) * 100;
return { x, y };
};