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
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" | |
android:background="@android:color/transparent" | |
android:gravity="center" | |
android:orientation="vertical"> | |
<RelativeLayout | |
android:layout_width="match_parent" |
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
{ | |
"version": 8, | |
"name": "Bright", | |
"metadata": { | |
"mapbox:autocomposite": false, | |
"mapbox:groups": { | |
"1444849242106.713": { | |
"collapsed": false, | |
"name": "Places" | |
}, |
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
"sources": { | |
"openmaptiles": { | |
"type": "vector", | |
"url": "mbtiles:///data/user/0/com.example.maplibretest/cache/india_coimbatore.mbtiles" | |
} | |
} |
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
//Fetching the local styles JSON file from the assets | |
val styleJsonInputStream = assets.open("bright.json") | |
//Creating a new file to which to copy the json content to | |
val dir = File(filesDir.absolutePath) | |
val styleFile = File(dir, "bright.json") | |
//Copying the original JSON content to new file | |
copyStreamToFile(styleJsonInputStream, styleFile) | |
//Getting reference to mbtiles file in assets |
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
country | region | bbox | |
---|---|---|---|
Afghanistan | Badakhshan | 35.44241059007663,69.99854943181077,38.47367340200013,74.89230676300008 | |
Afghanistan | Badghis | 34.5093667668628,62.651762729566315,36.0317323437726,65.04732710206406 | |
Afghanistan | Baghlan | 35.006700750838945,68.005234408641,36.571204739407165,69.9610323420689 | |
Afghanistan | Balkh | 35.66725474700894,66.2478739774021,37.385212708,68.18909915610112 | |
Afghanistan | Bamyan | 33.93792877938961,66.33060794540035,35.469618232295545,68.28268517398158 | |
Afghanistan | Farah | 31.388741287780192,60.56150191200004,33.51668834119397,64.73840538909741 | |
Afghanistan | Faryab | 35.18699982398266,63.88739790189163,37.241997468508316,65.8166858250907 | |
Afghanistan | Ghazni | 32.07184113206256,66.8291821628265,34.20933340081575,68.80017296680893 | |
Afghanistan | Ghor | 33.12257802995208,63.07075524305998,35.26973379198091,66.7740950866189 |
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 MapboxMap.limitViewToBounds(bounds: LatLngBounds) { | |
val newBoundsHeight = bounds.latitudeSpan - projection.visibleRegion.latLngBounds.latitudeSpan | |
val newBoundsWidth = bounds.longitudeSpan - projection.visibleRegion.latLngBounds.longitudeSpan | |
val leftTopLatLng = LatLng( | |
bounds.latNorth - (bounds.latitudeSpan - newBoundsHeight) / 2, | |
bounds.lonEast - (bounds.longitudeSpan - newBoundsWidth) / 2 - newBoundsWidth, | |
) |
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 { |
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
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
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)) |
OlderNewer