1import { MapContainer, TileLayer, Marker, Popup, Rectangle } from "react-leaflet"
2import 'leaflet/dist/leaflet.css'
3import MarkerClusterGroup from "react-leaflet-cluster"
4import { useEffect, useState } from "react"
6const START_LONG = -97.11141225279618
7const STEP_LONG = 0.00002949
9const LONG_0 = -97.11215105459435
10const LONG_1 = -97.11225975469435
11const LONG_2 = -97.11280605469435
12const LONG_3 = -97.11292905469435
14export function snapLongitudeBottom(long) {
15 // In region 1 (gap between Long2 and Long3) - free placement
16 if (long <= LONG_2 && long >= LONG_3) {
20 // In region 2 (gap between Long0 and Long1) - free placement
21 if (long <= LONG_0 && long >= LONG_1) {
25 // After Long3 (more negative than Long3) - start from Long3
27 const steps = Math.round((long - LONG_3) / STEP_LONG)
28 return LONG_3 + steps * STEP_LONG
31 // Between Long1 and Long2 - start from Long1
32 if (long < LONG_1 && long > LONG_2) {
33 const steps = Math.round((long - LONG_1) / STEP_LONG)
34 return LONG_1 + steps * STEP_LONG
37 // Default - before Long0, start from START_LONG
38 const steps = Math.round((long - START_LONG) / STEP_LONG)
39 return START_LONG + steps * STEP_LONG
42const REGION_LONGITUDES = [
58const REGION_LATITUDES = [
67export function snapLongitude(long) {
68 let closest = REGION_LONGITUDES[0]
69 let minDiff = Math.abs(long - closest)
71 for (let i = 1; i < REGION_LONGITUDES.length; i++) {
72 const diff = Math.abs(long - REGION_LONGITUDES[i])
75 closest = REGION_LONGITUDES[i]
82export function snapLatitude(lat) {
83 let closest = REGION_LATITUDES[0]
84 let minDiff = Math.abs(lat - closest)
86 for (let i = 1; i < REGION_LATITUDES.length; i++) {
87 const diff = Math.abs(lat - REGION_LATITUDES[i])
90 closest = REGION_LATITUDES[i]