Skip to content

Commit

Permalink
55921-elys
Browse files Browse the repository at this point in the history
  • Loading branch information
ELY M committed Nov 9, 2024
1 parent 88a5926 commit e309e77
Show file tree
Hide file tree
Showing 13 changed files with 95 additions and 156 deletions.
4 changes: 0 additions & 4 deletions app/src/main/java/joshuatee/wx/fingerdraw/DrawLineView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@ class DrawLineView : View {
this.mPositionY = mPositionY
this.ortInt = ortInt
this.oneDegreeScaleFactor = oneDegreeScaleFactor
// val xStr = RadarSites.getX(radarSite)
// val yStr = RadarSites.getY(radarSite)
// centerX = To.float(xStr)
// centerY = To.float(yStr)
val latLon = RadarSites.getLatLon(radarSite).reverse()
centerX = latLon.lat.toFloat()
centerY = latLon.lon.toFloat()
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/misc/CapAlert.kt
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CapAlert {
val lonTmp = points[0]
val list2 = lonTmp.split(",")
val lon = list2[1]
RadarSites.getNearestRadarSiteCode(LatLon(lat, lon))
RadarSites.getNearestCode(LatLon(lat, lon))
} else {
""
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class SpotterReportsActivity : BaseActivity() {
}

private fun itemClicked(position: Int) {
val radarSite = RadarSites.getNearestRadarSiteCode(UtilitySpotter.reports[position].latLon)
val radarSite = RadarSites.getNearestCode(UtilitySpotter.reports[position].latLon)
Route.radarWithOneSpotter(this, radarSite, UtilitySpotter.reports[position].uniq)
}
}
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/misc/SpottersActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class SpottersActivity : BaseActivity() {
}

private fun showItemOnRadar(position: Int) {
val radarSite = RadarSites.getNearestRadarSiteCode(spotterList[position].latLon)
val radarSite = RadarSites.getNearestCode(spotterList[position].latLon)
Route.radarWithOneSpotter(this, radarSite, spotterList[position].unique)
}

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/objects/ObjectWarning.kt
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class ObjectWarning() {
val lat = points[1]
val lon = "-" + points[0]
val latLon = LatLon(lat, lon)
RadarSites.getNearestRadarSiteCode(latLon)
RadarSites.getNearestCode(latLon)
} else {
""
}
Expand Down
102 changes: 42 additions & 60 deletions app/src/main/java/joshuatee/wx/radar/Metar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,9 @@ import android.graphics.Color
import joshuatee.wx.R
import joshuatee.wx.util.UtilityIO
import joshuatee.wx.util.UtilityMath
import joshuatee.wx.settings.UtilityLocation
import joshuatee.wx.common.GlobalVariables
import joshuatee.wx.common.RegExp
import joshuatee.wx.getHtmlWithNewLine
import joshuatee.wx.objects.DistanceUnit
import joshuatee.wx.objects.DownloadTimer
import joshuatee.wx.objects.LatLon
import joshuatee.wx.objects.Site
Expand All @@ -49,7 +47,7 @@ internal object Metar {
// A data structure (map) consisting of a Lat/Lon string array for each Obs site
private val obsLatLon = mutableMapOf<String, LatLon>()
val timer = DownloadTimer("METAR")
private val metarSites = mutableListOf<Site>()
private val sites = mutableListOf<Site>()
private val pattern1: Pattern = Pattern.compile(".*? (M?../M?..) .*?")
private val pattern2: Pattern = Pattern.compile(".*? A([0-9]{4})")
private val pattern3: Pattern = Pattern.compile("AUTO ([0-9].*?KT) .*?")
Expand Down Expand Up @@ -243,12 +241,12 @@ internal object Metar {
//
@Synchronized
private fun loadMetarData(context: Context) {
if (metarSites.isEmpty()) {
if (sites.isEmpty()) {
val metarDataAsList =
UtilityIO.rawFileToStringArrayFromResource(context.resources, R.raw.us_metar3)
metarDataAsList.forEach {
val tokens = it.split(" ")
metarSites.add(Site.fromLatLon(tokens[0], LatLon(tokens[1], tokens[2])))
sites.add(Site.fromLatLon(tokens[0], LatLon(tokens[1], tokens[2])))
}
}
}
Expand All @@ -258,7 +256,7 @@ internal object Metar {
// possibly reverting to older code below
fun findClosestObservation(context: Context, location: LatLon, index: Int = 0): Site {
loadMetarData(context)
val obsSites = metarSites.toMutableList()
val obsSites = sites.toMutableList()
// obsSites.forEach {
// it.distance = LatLon.distance(location, it.location, DistanceUnit.MILE).toInt()
// }
Expand All @@ -280,19 +278,17 @@ internal object Metar {
// Used only within this class in one spot
// Used for nexrad radar when obs site is turn on
//
@Suppress("SpellCheckingInspection")
private fun getNearbyObsSites(context: Context, radarSite: String): String {
val radarLocation = RadarSites.getLatLon(radarSite)
val obsListSb = StringBuilder(100)
val obsListSb = StringBuilder(1000)
loadMetarData(context)
metarSites.forEach {
sites.forEach {
if (LatLon.distance(radarLocation, it.latLon) < 200.0) {
obsListSb.append(it.codeName)
obsListSb.append(",")
}
}
return obsListSb.toString().replace(",$".toRegex(), "")
//return "KARB,KYIP,KBLF,KBKW,KCKB,KCMH,KCRW,KDCA,KEKN,KHLG,KHTS,KI16,KILN,KLEX,KLNP,KLOZ,KMGW,KMRB,KPIT,KPKB,KROA,KTRI,KW22,KW99,KZZV";
}

// used to condense a list of metar that contains multiple entries for one site, newest is first so simply grab first/append
Expand All @@ -314,56 +310,42 @@ internal object Metar {

/*
https://aviationweather.gov/cgi-bin/data/metar.php?ids=K0F2,K13K,K1F0,K1K1,K3AU,K4O4,KAAO,KADH,KADM,KADS,KAFW,KASG,KAVK,KAXS,KBEC,KBKN,KBVO,KCDS,KCFV,KCHK,KCLK,KCNU,KCQB,KCSM,KCUH,KCWC,KDAL,KDEQ,KDFW,KDTO,KDUA,KDUC,KELK,KEND,KEQA,KEWK,KF00,KF05,KF46,KFDR,KFSI,KFSM,KFTW,KFWS,KFYV,KGAG,KGCM,KGKY,KGLE,KGMJ,KGOK,KGPM,KGVT,KGYI,KGZL,KH71,KHBR,KHHF,KHQZ,KHSD,KHUT,KIAB,KICT,KIDP,KJLN,KJSV,KJWG,KLAW,KLNC,KLTS,KLUD,KMEZ,KMIO,KMKO,KMLC,KMWL,KNFW,KOJA,KOKC,KOKM,KOUN,KOWP,KP28,KPNC,KPPF,KPRX,KPTT,KPVJ,KPWA,KRBD,KRCE,KRKR,KROG,KRPH,KRQO,KRVS,KSLG,KSLR,KSNL,KSPS,KSRE,KSWO,KTIK,KTKI,KTQH,KTRL,KTUL,KVBT,KWDG,KWLD,KWWR,KXBP,KXNA
https://aviationweather.gov/cgi-bin/data/metar.php?ids=K1BW,K1CW,K1HW,K2WX,K7L2,K9V9,KAIA,KANW,KBFF,KBHK,KBWW,KBYG,KCDR,KCUT,KD07,KD57,KDGW,KDIK,KEAN,KECS,KGCC,KGRN,KGUR,KHEI,KICR,KIEN,KMBG,KPHP,KPIR,KRAP,KRCA,KSPF,KTIF,KTOR,KVTN,KW43
sample:
K0F2 021015Z AUTO 13007KT 5SM BR OVC005 19/18 A3007 RMK AO2 T01850178
K13K 021015Z AUTO 07007KT 10SM BKN015 OVC026 10/09 A3016 RMK AO2 LTG DSNT W T01020086
K1F0 021015Z AUTO 13007KT 5SM BR OVC005 18/17 A3009 RMK AO2 T01820172
K3AU 021015Z AUTO 09007KT 10SM OVC013 13/08 A3010 RMK AO2
K4O4 021015Z AUTO 08006KT 6SM BR OVC005 17/17 A3013 RMK AO2
KAAO 021017Z AUTO 04005KT 10SM VCTS OVC013 13/09 A3010 RMK AO2 LTG DSNT ALQDS T01330094
KADH 021015Z AUTO 13009KT 1SM BR OVC003 17/17 A3011 RMK AO2
KADS 021015Z AUTO 12008KT 9SM BKN010 OVC022 20/19 A3007 RMK AO2
KAFW 021016Z 12007KT 7SM BKN010 BKN014 OVC032 20/18 A3006 RMK AO2 CIG 007V013 T02000183
KAVK 021015Z AUTO 15008KT 10SM -RA BKN012 OVC024 16/15 A3002 RMK AO2 LTG DSNT W-NE
KAXS 021015Z AUTO 14016KT 3SM -RA BR OVC003 18/18 A3004 RMK AO2
KBEC 021015Z AUTO 10008KT 10SM VCTS OVC013 14/10 A3009 RMK AO2 LTG DSNT SW THRU N T01350095
KBKN 021015Z AUTO 14011KT 10SM OVC008 15/15 A3009 RMK AO2
KBVO 020953Z AUTO 19003KT 10SM BKN030 12/11 A3014 RMK AO2 SLP200 T01220106
KCDS 020953Z AUTO 15011KT 4SM -RA BR OVC003 17/17 A3003 RMK AO2 RAB52 SLP152 P0000 T01720172
KCFV 020952Z AUTO 13004KT 10SM OVC026 13/11 A3014 RMK AO2 SLP202 T01330106
KCHK 021015Z AUTO 13007KT 7SM OVC007 18/17 A3006 RMK AO2 T01760167
KCLK 021015Z AUTO 16009KT 3SM BR OVC006 17/16 A3006 RMK AO2 LTG DSNT N AND SW
KCNU 021017Z AUTO 12008KT 10SM BKN022 OVC080 12/08 A3016 RMK AO2 T01220083
KCQB 021015Z AUTO 11005KT 10SM OVC008 16/14 A3012 RMK AO2 T01570141
KCSM 021001Z AUTO 16017KT 2 1/2SM -RA BR OVC004 17/17 A3005 RMK AO2 P0000 T01720167
KCUH 021015Z AUTO 15005KT 10SM OVC012 16/13 A3010 RMK AO2 LTG DSNT NW T01600133
KCWC 021015Z AUTO 17011G15KT 120V180 10SM BKN012 OVC017 20/18 A3007 RMK AO2 LTG DSNT W T01950176
KDAL 021024Z 13006KT 6SM -RA BR OVC009 20/19 A3006 RMK AO2 RAB15 P0000 T02000189
KDEQ 021006Z AUTO 08004KT 10SM OVC009 18/16 A3013 RMK AO2 T01780161
KDFW 020953Z 11007KT 7SM OVC010 20/18 A3006 RMK AO2 SLP171 T02000183 $
KDTO 021000Z AUTO 14006KT 10SM BKN010 OVC014 20/18 A3007 RMK AO2 T02000183
KDUA 021015Z AUTO 11008KT 3SM BR OVC003 18/18 A3013 RMK AO2
KDUC 021015Z AUTO 13010KT 7SM BR OVC006 18/17 A3009 RMK AO2
KELK 021015Z AUTO 16009G16KT 5SM BR OVC003 17/17 A3004 RMK AO2 LTG DSNT N AND W RAE1013 P0001 T01690169 $
KEND 021010Z AUTO 14006KT 10SM FEW009 BKN025 OVC033 16/14 A3003 RMK AO2 CIG 023 RWY35C SLP163 $
KEQA 021015Z AUTO 08007KT 10SM OVC013 13/10 A3012 RMK AO2
KEWK 021015Z AUTO 16012KT 10SM -TSRA FEW024 BKN032 OVC075 13/13 A3011 RMK AO2 LTG DSNT ALQDS PNO $
KF00 021015Z AUTO 10005KT 5SM BR OVC004 18/18 A3011 RMK AO2 T01790178
KF05 021020Z AUTO 13010KT 5SM OVC007 19/19 A3004 RMK AO2 LTG DSNT W T01920186
KF46 021015Z AUTO 11005KT 7SM OVC007 20/20 A3008 RMK AO2 T01950195
KFDR 020953Z AUTO 14011KT 8SM OVC010 19/17 A3003 RMK AO2 SLP154 T01890167
KFSM 020953Z 08008KT 10SM OVC019 17/13 A3016 RMK AO2 SLP210 T01670128
KFTW 020953Z 11006KT 8SM OVC009 20/18 A3006 RMK AO2 CIG 007V012 SLP171 T02000183
KFWS 021015Z AUTO 11004KT 10SM OVC007 20/19 A3008 RMK AO2 T02010190
KFYV 020953Z AUTO 00000KT 10SM OVC014 14/12 A3018 RMK AO2 SLP211 T01440117
KGAG 021009Z AUTO 17016G22KT 9SM VCTS -RA OVC009 17/16 A3002 RMK AO2 LTG DSNT SW-N RAB00 CIG 004V011 P0000 T01720161
KGCM 021015Z AUTO 11006KT 10SM OVC023 16/15 A3013 RMK AO2
KGKY 020953Z AUTO 11007KT 10SM BKN011 OVC029 21/18 A3007 RMK AO2 CIG 009V014 SLP174 T02110183
KGMJ 021015Z AUTO 09004KT 10SM OVC023 12/11 A3016 RMK AO2 TSNO
KGOK 020953Z AUTO 17011G17KT 10SM OVC007 17/16 A3009 RMK AO2 SLP183 T01670161
KGPM 021015Z AUTO 09006KT 10SM SCT010 OVC024 20/20 A3008 RMK AO2 T02020201
K1BW 081955Z AUTO 36006KT 8SM -RA BKN025 OVC030 02/01 A3022 RMK AO2 RAE1859DZB1859E03RAB03 SLP258 P0002 T00220007 $
K1CW 081955Z AUTO 02004KT 10SM -RA SCT029 OVC039 04/02 A3021 RMK AO2 RAB07E20DZB20E22RAB22 SLP236 P0000 T00420017 $
K1HW 081955Z AUTO 03009KT 10SM -RA OVC036 05/02 A3017 RMK AO2 RAE06DZB06E12RAB12 SLP229 P0000 T00510018 $
K2WX 081956Z AUTO 18012KT 13/M07 A3014 RMK AO1 SLP220 T01281072
K7L2 082015Z AUTO 18007KT 10SM CLR 12/M02 A3024 RMK AO2
K9V9 082015Z AUTO 00000KT 10SM CLR 11/02 A3024 RMK AO2 T01050019
KAIA 081953Z AUTO 00000KT 10SM OVC050 08/01 A3020 RMK AO2 SLP232 T00830011
KANW 082015Z AUTO 09004KT 10SM SCT100 12/03 A3025 RMK AO2 T01220025
KBFF 081953Z AUTO 26005KT 10SM OVC055 06/M01 A3022 RMK AO2 SLP243 T00611011
KBHK 081951Z AUTO 20011KT 10SM CLR 15/M02 A3016 RMK AO2 SLP223 T01501022
KBWW 082015Z AUTO 20011KT 10SM CLR 14/M05 A3015 RMK AO2
KBYG 081953Z AUTO 14011KT 10SM CLR 13/M01 A3013 RMK AO2 SLP192 T01281011
KCDR 081953Z AUTO 29004KT 10SM BKN080 10/01 A3020 RMK AO2 SLP245 T01000006
KCUT 081953Z AUTO 19007KT 10SM CLR 11/01 A3021 RMK AO2 SLP228 T01110006
KD07 081956Z AUTO 19005KT 13/M05 A3018 RMK AO1 SLP236 T01331050
KD57 082015Z AUTO 21008G15KT 10SM CLR 14/M03 A3016 RMK AO2
KDGW 081953Z AUTO 00000KT 10SM CLR 07/M06 A3020 RMK AO2 SLP246 T00721056
KDIK 081956Z AUTO 19012KT 10SM CLR 14/M02 A3015 RMK AO2 SLP223 T01391017
KEAN 082015Z AUTO 00000KT 10SM -DZ SCT043 BKN060 OVC070 04/M02 A3021 RMK AO2 T00401017
KECS 082015Z AUTO 19006KT 10SM CLR 08/M07 A3022 RMK AO2
KGCC 081953Z AUTO 19008KT 10SM CLR 12/M04 A3016 RMK AO2 SLP222 T01171044
KGRN 082015Z AUTO 00000KT 10SM CLR 11/01 A3020 RMK AO2 T01050007
KGUR 081955Z AUTO 31003KT 9SM BKN065 OVC120 06/M01 A3019 RMK AO2 SLP265 T00631014
KHEI 081953Z AUTO 18010KT 10SM CLR 14/M03 A3018 RMK AO2 SLP234 T01441033
KICR 081953Z AUTO 00000KT 10SM CLR 13/02 A3024 RMK AO2 SLP246 T01330017
KIEN 081952Z AUTO 00000KT 10SM FEW085 10/01 A3021 RMK AO2 SLP242 T01000006
KMBG 081952Z AUTO 00000KT 10SM CLR 14/M02 A3018 RMK AO2 SLP230 T01391017
KPHP 081955Z AUTO 00000KT 10SM CLR 13/01 A3020 RMK AO2 SLP233 T01330006
KPIR 081953Z AUTO 20004KT 10SM CLR 11/01 A3021 RMK AO2 SLP239 T01060011
KRAP 081952Z 11005KT 10SM CLR 12/M07 A3019 RMK AO2 SLP239 T01221067
KRCA 081955Z AUTO 12007KT 10SM CLR 11/M07 A3015 RMK AO2 SLP229 T01101073 $
KSPF 082015Z AUTO 03007KT 10SM CLR 11/M05 A3019 RMK AO2
KTIF 082015Z AUTO 11007KT 10SM BKN070 OVC080 11/01 A3023 RMK AO2 T01130013
KTOR 081953Z AUTO 00000KT 10SM OVC048 04/M02 A3021 RMK AO2 SLP247 T00391017
KVTN 081952Z AUTO VRB04KT 10SM CLR 12/02 A3024 RMK AO2 SLP249 T01220022
*/
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import joshuatee.wx.objects.LatLon
import joshuatee.wx.objects.Route //elys mod
import joshuatee.wx.settings.UIPreferences
import joshuatee.wx.settings.RadarPreferences
import joshuatee.wx.util.To
import kotlin.math.*

class NexradRenderSurfaceView : GLSurfaceView, GestureDetector.OnGestureListener,
Expand Down Expand Up @@ -226,11 +225,7 @@ class NexradRenderSurfaceView : GLSurfaceView, GestureDetector.OnGestureListener
yMiddle = height / 2.0f
val diffX = density * (xMiddle - xPos) / mScaleFactor
val diffY = density * (yMiddle - yPos) / mScaleFactor
// val xStr = RadarSites.getX(wxglRender.state.rid)
// val yStr = RadarSites.getRadarSiteY(wxglRender.state.rid)
val latLon = RadarSites.getLatLon(wxglRender.state.rid).reverse()
// centerX = To.float(xStr)
// centerY = To.float(yStr)
centerX = latLon.lat.toFloat()
centerY = latLon.lon.toFloat()
val ppd = wxglRender.state.projectionNumbers.oneDegreeScaleFactor
Expand All @@ -239,7 +234,7 @@ class NexradRenderSurfaceView : GLSurfaceView, GestureDetector.OnGestureListener
newY = test2 + (-1.0 * wxglRender.state.y / mScaleFactor + diffY) / ppd
newY = (180.0 / PI * (2.0 * atan(exp(newY * PI / 180.0)) - PI / 2.0))
wxglRender.state.closestRadarSites =
RadarSites.getNearestRadarSites(LatLon(newY, newX * -1.0), 5)
RadarSites.getNearest(LatLon(newY, newX * -1.0), 5)
listener?.onProgressChanged(index, index, idxInt)
}

Expand Down
69 changes: 33 additions & 36 deletions app/src/main/java/joshuatee/wx/radar/RadarSites.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,37 @@ package joshuatee.wx.radar
import joshuatee.wx.objects.LatLon
import joshuatee.wx.objects.Site
import joshuatee.wx.objects.Sites
import joshuatee.wx.settings.UtilityLocation

@Suppress("SpellCheckingInspection")
object RadarSites {

// grep NWS_LOC UtilityPref.dart |sed "s/Utility.writePref(.NWS_LOCATION_/\"/" | sed 's/",/" to/' | sed "s/);/,/"

fun getName(radarSite: String): String = names[radarSite] ?: ""

fun getLatLon(radarSite: String): LatLon {
val lat = lat[radarSite] ?: ""
val lon = "-" + (RadarSites.lon[radarSite] ?: "")
val lon = "-" + (lon[radarSite] ?: "")
return LatLon(lat, lon)
}

// private fun getX(radarSite: String): String = lat[radarSite] ?: ""
//
// private fun getY(radarSite: String): String = lon[radarSite] ?: ""
private fun nexradRadarCodes(): List<String> {
val radars = mutableListOf<String>()
for (radar in sites.codeList) {
if (!radar.startsWith("T")) {
radars.add(radar)
}
}
return radars
}

private fun tdwrRadarCodes(): List<String> {
val radars = mutableListOf<String>()
for (radar in sites.codeList) {
if (radar.startsWith("T")) {
radars.add(radar)
}
}
return radars
}

fun nexradRadars(): List<String> {
val radars = mutableListOf<String>()
Expand All @@ -63,50 +76,34 @@ object RadarSites {
return radars
}

fun getNearestRadarSites(
fun getNearest(
location: LatLon,
count: Int,
includeTdwr: Boolean = true
): List<Site> {
val radarSites = mutableListOf<Site>()
nexradRadars().forEach {
val labels = it.split(":")
val allRadars = nexradRadarCodes().toMutableList()
if (includeTdwr) {
allRadars += tdwrRadarCodes()
}
allRadars.forEach {
val latLon = getLatLon(it)
radarSites.add(
Site.fromLatLon(
labels[0],
getLatLon(labels[0]),
LatLon.distance(
location,
getLatLon(labels[0]),
)
it,
latLon,
LatLon.distance(location, latLon)
)
)
}
if (includeTdwr) {
tdwrRadars().forEach {
val labels = it.split(":")
radarSites.add(
Site.fromLatLon(
labels[0],
getLatLon(labels[0]),
LatLon.distance(
location,
getLatLon(labels[0]),
)
)
)
}
}
radarSites.sortBy { it.distance }
return radarSites.subList(0, count)
return radarSites.slice(0 until count)
}

fun getNearestRadarSiteCode(
fun getNearestCode(
location: LatLon,
includeTdwr: Boolean = false
): String {
return getNearestRadarSites(location, 5, includeTdwr)[0].codeName
}
): String = getNearest(location, 5, includeTdwr)[0].codeName

private val names = mapOf(
"JUA" to "PR, San Juan",
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/settings/Location.kt
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ object Location {
wfo = WfoSites.sites.getNearest(LatLon(xStr, yStr))
}
if (radarSite == "" || radarSite == "LIX") {
radarSite = RadarSites.getNearestRadarSiteCode(LatLon(xStr, yStr))
radarSite = RadarSites.getNearestCode(LatLon(xStr, yStr))
}
// CT shows mosaic not nexrad so the old way is needed
if (radarSite == "") {
Expand Down
9 changes: 0 additions & 9 deletions app/src/main/java/joshuatee/wx/settings/UtilityLocation.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ import android.location.LocationManager
import androidx.core.content.ContextCompat
import joshuatee.wx.objects.LatLon
import joshuatee.wx.objects.Site
import joshuatee.wx.radar.RadarSites
import joshuatee.wx.util.To
import joshuatee.wx.util.UtilityLog
import java.util.Locale

object UtilityLocation {

Expand Down Expand Up @@ -92,13 +90,6 @@ object UtilityLocation {
return gps
}

// fun getSiteLocation(site: String): LatLon {
// val addChar = "-"
// val x = RadarSites.getRadarSiteX(site.uppercase(Locale.US))
// val y = addChar + RadarSites.getRadarSiteY(site.uppercase(Locale.US))
// return LatLon(x, y)
// }

fun getNearest(latLon: LatLon, sectorToLatLon: Map<String, LatLon>): String {
val sites = mutableListOf<Site>()
sectorToLatLon.forEach { (k, v) ->
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/joshuatee/wx/spc/ObjectWatchProduct.kt
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ internal class ObjectWatchProduct(val type: PolygonType, productNumber: String)
return if (latLons.size > 2) {
val latLonList = LatLon.parseStringToLatLons(stringOfLatLon, -1.0, isWarning = false)
val center = getCenterOfPolygon(latLonList)
RadarSites.getNearestRadarSiteCode(center)
RadarSites.getNearestCode(center)
} else {
""
}
Expand Down
Loading

0 comments on commit e309e77

Please sign in to comment.