Semua tulisan dari kampar

Born in small village, Penyasawan, 13 km East of Bangkinang, Capital of Kampar Regency, or 47km West of Pekanbaru, Capital of Riau Province, Indonesia. He traveled 300 km away from his family to pursue his high school education in SMU 1 Padang, the Capital City of West Sumatera Province, Indonesia. He then continue his tertiary education in Universitas Padjajaran (being accepted in Faculty of Medicine) but later next year he enrolled Computer Science in Universitas Indonesia, Depok, West Java. In 2008, He continue his study and pursuing Master of Information Systems from University of Wollongong, NSW, Australia. He is now a father of three lovely daughters and live in East Salo, Kampar, Riau. If you meet him, he can speak with you in English, Minang, Malay, Ocu, or Bahasa.

JavaScript file untuk membuat grid RBI

Jika Anda tertarik untuk mempelajari JavaScript membuat batas peta RBI, silahkan download dari Github saya

https://github.com/kampar/rbi_geojson

Di sana ada file app.js yang membutuhkan dahulu script dari LeafletJS dan FileSaver.JS yang dapat dengan mudah Anda download dari Internet.

Jika malas mencoba, Anda dapat mendownload saja file geojson yang sudah saya hasilkan …

Kalau ingin menangis dan bertapa, silahkan lihat kodingan javascript nya di file app.js

hahahaha

JavaScript aneh dalam perhitungan matematika, jadi agak ribet tadi dalam pembulatan … perhatikan bahwa 0100 di JavaScript

Ada yang tahu kenapa 100 dibagi 10 adalah sepuluh dan 0100 dibagi 10 adalah 6.4?

hint: oktal (basis 8)

ada lagi yang aneh dalam Math.round, yang seharusnya menghasilkan bilangan bulat (integer)

tetapi integer hasil Math.round bisa berbeda kalau nanti dibuat ke perhitungan, lain dengan Math.floor (bilangan bulat dibawah bilangan sekarang)

that’s the power of tulisan jawa … hahahaha

Demo pemecahan RBI 10ribu ke A3 skala 5ribu

Ceritanya, di kantor hanya ada printer A3. Anda butuh mencetak peta skala 5000, misalnya untuk Rencana Tata Ruang di QGIS.

Nah, berdasarkan pengalaman saya, RBI 10ribu terpaksa dipecah menjadi 4×3, yaitu 4 baris dan 3 kolom yang bisa masuk ke sebuah peta ukuran kertas A3 untuk dicetak.

Nah, dari QGIS, tinggal kita bagi saja batas (extents) dari RBI tadi menjadi 4baris3kolom, lalu masing-masing wilayah tinggal dibuatkan Atlasnya. Demo hasilnya dapat dilihat pada link Github Page saya…

https://kampar.github.io/0816-2317/

Github Page dengan Leaflet.JS

Anda mau lihat jeroannya, source code nya, bisa saja dari Github saya,

https://github.com/kampar/0816-2317


Use WinRAR rar.exe console to compress DEMNAS GeoTIFF files

if you’ve download DEMNAS from BIG, you’ll realise that those files are NOT EVEN compressed, pure bitmap raw files … I’m not sure why BIG didn’t DEFLATE those files before distributing them … but, they only 140 GB … and if you using mobile plan to download it … ONLY cost you IDR 1,2 million… CHEAP for majority of Geo-enthusiasts and students in Indonesia … as long as there are no interruptions whilst you download it … I’ve been struggle re-download it again with newer download.php mechanism who I think too SMART … can’t even resume the download … thank BIG for that … I’ve swear a lot…

Ok … now let’s back to the topics of this blog …

If you’ve downloaded all those DEMNAS files, best way to resize those files when you’re using Ms Windows is by compressing it. I love to compress files with tar -czvf commands in linux … but in MS Windows, we have rar.exe

best switch for rar.exe are -m5 -s to create BEST,SMALLEST archive possible (-m5) and solid (-s). Solid means that all files are combined and re-compress it again. Longer (couple of milliseconds) but worth compression.

so, to compress demnas.tif file into demnas.rar you can use this following command in your CMD.exe

rar a -m5 -s -df DEMNAS_2912-24_v1.0.rar DEMNAS_2912-24_v1.0.tif

additional -df switch is to delete old source non compressed files after compressing done…

trouble shooting …

What if you cant call rar.exe from CMD.exe?

you got error ‘rar’ is not recognized as an internal or external command …

well …. you need to include winrar folder into your PATH … type following code into your CMD prior to calling that rar.exe

set PATH="C:\Program Files (x86)\WinRAR";%PATH%

I have plenty of DEMNAS files, should I type it one by one?

if you want to script it … my best way is to list all those files and put it on single file out.cmd

dir /b *.tif out.cmd

you’ll have a single out.cmd file which lists all of TIF files within current directory

What next?

Open this file with Notepad++

Ctrl+H to open replace pop-up using regex … in Notepad++

find what

^(DEMNAS.*).tif

replace with

rar a -m5 -s -df $1.rar $0
2019-02-27_11-06-44-regex MAKE SURE YOU SELECT radio button Regular expression instead of Normal search mode (default)

this regular expression will find all line which starting (^) with DEMNAS .* whatever and have .tif at somewhere within current line.

$1 is any string WITHIN bracket on find string .. in my case it’s DEMNASwhatever

$0 is whole find string … in this case is DEMNASwhatever.tif

Notepad++ and CMD in actions…

I’ve add set PATH command at line #1 in my cmd file…

REM is for commenting / REMARK … in cmd file

What you’ve been done?

Original DEMNAS papua 3,8 Gigabyte on first DVD is became 700 MB only … worth compression …

RIP English

F U