This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
//map init code.. | |
val path = createDummyPath() | |
val lineOnMap = showPathOnMap(path) | |
v.clearButton.setOnClickListener { | |
lineManager.delete(lineOnMap) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override fun onCreate(savedInstanceState: Bundle?) { | |
//map init code.. | |
val path = createDummyPath() | |
val lineOnMap = showPathOnMap(path) | |
} | |
private fun showPathOnMap(path: List<Radio>) : Line { | |
val lineOptions = LineOptions() | |
.withLineColor("#3949AB") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun createDummyPath() = arrayListOf( | |
LatLng(35.12972888243833, 137.30017964781746), | |
LatLng(35.16003270167863, 137.34192854082988), | |
LatLng(35.175866072622306, 137.4588457531761), | |
LatLng(35.098973418374655, 137.55921143244922), | |
LatLng(35.15312262941834, 137.65852062512363), | |
LatLng(35.2538363762526, 137.73846100826395), | |
LatLng(35.199466465206655, 137.92757107763117), | |
LatLng(35.31736555432611, 137.92545811180227), | |
LatLng(35.42017123490391, 137.97405622936287), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private val mapView: MapView by lazy { v.mapView } | |
private lateinit var lineManager: LineManager | |
private lateinit var map: MapboxMap | |
private val v: ActivityMainBinding by lazy { | |
ActivityTsasBinding.inflate(layoutInflater) | |
} | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
zoom = 8, leftBottomTiles = (182, 118), rightTopTiles = (183, 118), tileCount = 2 | |
zoom = 9, leftBottomTiles = (365, 237), rightTopTiles = (367, 236), tileCount = 6 | |
zoom = 10, leftBottomTiles = (731, 474), rightTopTiles = (734, 472), tileCount = 12 | |
20 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print(getTotalTileCount((13.18178, 77.12267), (13.88948, 78.11077), 8, 10)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def getTotalTileCount(leftBottom, rightTop, fromZoom, toZoom): | |
totalTileCount = 0 | |
for zoom in range(fromZoom, toZoom + 1): | |
leftBottomTiles = deg2num(leftBottom, zoom) | |
rightTopTiles = deg2num(rightTop, zoom) | |
currentTileCount = (rightTopTiles[0] - leftBottomTiles[0] + 1) * (leftBottomTiles[1] - rightTopTiles[1] + 1) | |
print("zoom = " + str(zoom) + ", leftBottomTiles = " + str(leftBottomTiles) + | |
", rightTopTiles = " + str(rightTopTiles) + ", tileCount = " + str(currentTileCount)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def deg2num(lat_deg, lon_deg, zoom): | |
lat_rad = math.radians(lat_deg) | |
n = 2.0 ** zoom | |
xtile = int((lon_deg + 180.0) / 360.0 * n) | |
ytile = int((1.0 - math.asinh(math.tan(lat_rad)) / math.pi) / 2.0 * n) | |
return (xtile, ytile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This statement gets the date of 2 days back. Did this becasue if the script is running on 25th, | |
-- I'm not sure if the data for 24th is ready or not. It depends on what timezone the analytics server | |
-- is running off of and when do they consider 24th to be over. So 2 days period is safe | |
DECLARE backup_date DATE DEFAULT DATE_SUB(CURRENT_DATE(), INTERVAL 2 day); | |
DECLARE date_str STRING; | |
DECLARE table_name STRING; | |
DECLARE sql STRING; | |
DECLARE date_str_folder STRING; | |
DECLARE date_str_table STRING; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
map.animateCamera(CameraUpdateFactory.newLatLngBounds(bounds, 0), | |
object : MapboxMap.CancelableCallback { | |
override fun onCancel() {} | |
override fun onFinish() { | |
map.setMinZoomPreference(map.cameraPosition.zoom) | |
map.limitViewToBounds(bounds) | |
map.addOnScaleListener(object : MapboxMap.OnScaleListener { |
NewerOlder