Skip to content

Instantly share code, notes, and snippets.

View kampar's full-sized avatar
🏠
Working from home

Muhammad Jazman kampar

🏠
Working from home
View GitHub Profile
@kampar
kampar / wget_unduhTileDariESRI.vb
Created January 1, 2017 16:31
perintah untuk membuat sebuah file cmd untuk mengunduh tile dari ESRI
Sub testTile()
Dim x, y, z As Integer
Dim isi As String
Dim fileNumber As Integer
fileNumber = FreeFile
'http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/5/15/24
'format is JPG
@kampar
kampar / cdn_local_worldimagery.html
Created January 1, 2017 16:58
Demo Localcopy of ESRI WorldImagery after finishing download all tiles lv 0 to 5. See this blog: https://dosengis.wordpress.com/2017/01/01/mengunduh-ubin-dari-esri/
<!DOCTYPE html>
<html>
<head>
<title>Leaflet CDN - Local WorldImagery</title>
<style>
html, body, #map{
height: 100%;
margin: 0px;
padding: 0px
}
@kampar
kampar / stamenWaterColor.vb
Created January 1, 2017 19:13
VBA script untuk mengunduh ubin dari stamen kolor berair via wget di Ms Windows
Sub stamenWaterColor()
' subprosedur untuk membuat sebuah batch file untuk mendownload ubin dari stamen
' stamen_watercolor = L.tileLayer('http://{s}.tile.stamen.com/watercolor/{z}/{x}/{y}.jpg');
'
' ubin di download menggunakan wget
'
' logika yang dilakukan adalah membuat sebuah direktori dahulu untuk mendownloadnya
' (karena wget -x hanya untuk direktori yang sama, makanya tidak bisa)
' solusi adalah dengan wget -O
'
@kampar
kampar / mapnik.js
Created February 25, 2017 23:48
JavaScript snippet to play around with mapnik tile
function long2tile(lon,zoom) {
return (Math.floor((lon+180)/360*Math.pow(2,zoom)));
}
function lat2tile(lat,zoom) { return (Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom))); }
function tile2lon(x,z) {
return (x/Math.pow(2,z)*360-180);
}
function tile2lat(y,z) {
@kampar
kampar / coord_to_bat.vb
Created May 7, 2017 09:05
Ms Windows batch file generator untuk download ubin dari ESRI World_Imagery, menggunakan wget untuk download dan ImageMagick untuk gabung
Sub debugprint(x1 As Integer, x2 As Integer, y1 As Integer, y2 As Integer, z As Integer)
Dim x, y As Integer
For x = x1 To x2
For y = y1 To y2
Debug.Print "wget -O " & z & "-" & x & "-" & y & ".jpg " & "http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/" & z & "/" & y & "/" & x
Next y
Next x
'Debug.Print "Banyak Kolom=" & (x2 - x1 + 1)
@kampar
kampar / leaflet_coord.html
Last active November 12, 2017 14:10
Leaflet Coordinate untuk mencari tahu nomor ubin slippy-hill untuk ubin sekarang
<!DOCTYPE html>
<html>
<head>
<title>Leaflet CDN</title>
<style>
html, body, #map{
height: 100%;
margin: 0px;
padding: 0px
}
@kampar
kampar / US Army Maps v17 Indonesia.csv
Created July 11, 2017 08:01
US Army Maps v17 for populated city or important place circa 1954 hosted by Univ Texas
id place_name url
NA 46-8 Sibago http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na46-8.jpg
NA 47-1 Tapaktuan http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-1.jpg
NA 47-2 Medan http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-2.jpg
NA 47-3 Tebingtinggi http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-3.jpg
NA 47-5 Sinabang http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-5.jpg
NA 47-6 Pangururan http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-6.jpg
NA 47-7 Tandjungbalai http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-7.jpg
NA 47-8 Bagan Siapiapi http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-8.jpg
NA 47-9 Lahewa http://www.lib.utexas.edu/maps/ams/indonesia/txu-oclc-21752461-na47-9.jpg
@kampar
kampar / id.kampar.libgen.user.js
Created July 12, 2017 07:04
Libgen change javascript links into download links
// ==UserScript==
// @name Libgen direct page
// @namespace id.kampar.libgen
// @description change javascript link into real link
// @include https://libgen.pw/search.php*
// @version 1
// @grant none
// ==/UserScript==
a_ns = document.evaluate('//a[contains(@href, "javascript:window.open")]', document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
@kampar
kampar / googleTile.vb
Created July 19, 2017 08:48
Google Tile Visual Basic 6 (VBA)
Type titik
x As Long
y As Long
End Type
Private Function CalcTileXY(ByVal lat As Single, ByVal lon As Single, ByVal zoom As Long) As titik
CalcTileXY.x = CLng(((lon + 180) / 360 * 2 ^ zoom))
CalcTileXY.y = CLng(((1 - Math.Log(Math.Tan(lat * pi / 180) + 1 / Math.Cos(lat * pi / 180)) / pi) / 2 * 2 ^ zoom))
End Function
@kampar
kampar / hot_stat_20171204.html
Created December 20, 2017 16:55
demo convert HOT (humanitarian OSM team) indonesian statistics on building as 2012 Dec 04, originally on SVG, converted into canvas
<body><h2>Laporan Statistik Bangunan pada Senin, 4 Desember 2017 </h2>
<div id="chart"><svg width="1020" height="1050" id="myViewer" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" style="overflow:scroll;margin:0;"><g transform="translate(170,20)"><text x="0" dy="-3" text-anchor="middle">0</text><text x="59.96898746648162" dy="-3" text-anchor="middle">200000</text><text x="119.93797493296324" dy="-3" text-anchor="middle">400000</text><text x="179.90696239944486" dy="-3" text-anchor="middle">600000</text><text x="239.8759498659265" dy="-3" text-anchor="middle">800000</text><text x="299.8449373324081" dy="-3" text-anchor="middle">1000000</text><text x="359.81392479888973" dy="-3" text-anchor="middle">1200000</text><text x="419.7829122653714" dy="-3" text-anchor="middle">1400000</text><text x="479.751899731853" dy="-3" text-anchor="middle">1600000</text><text x="539.7208871983346" dy="-3" text-anchor="middle">1800000</text><text x="599.6898746648162" dy="-3" text-anchor="middle">