Menghitung Jarak Antara Dua Titik Koordinat Dengan PostGIS

postgresql Menghitung Jarak Antara Dua Titik Koordinat Dengan PostGISAnda tentu pernah mengecek keberadaan sebuah tempat dengan menggunakan peta bukan?Nah di dalam peta tersebut atau bisa juga atlas terdapat sistem koordinat yang memetakan tempat tersebut. Ada banyak sistem koordinat yang sudah didefinisikan. Di sini kita menggunakan sistem koordinat yang digunakan oleh peta pada umumnya, yaitu lintang dan bujur, alias latitude dan longitude. Keduanya tersimpan dalam bentuk bilangan desimal, bisa positif atau negatif.

Misalnya koordinat Margonda, Depok yaitu Latitude -6,369368 berarti lintang selatan ( karena negatif ), dan longitude 106,832986 berarti bujur timur (karena positif). Kemudian koordinat kedua adalah Senen, Jakarta Pusat, yaitu:  Latitude -6.179036 dan longitude 106.843870.

Namun bagaimanakah cara Anda mengukur jarak antara kedua tempat atau koordinat tersebut?Salah satunya dengan menggunakan PostGIS sebuah fitur tambahan pada Database PostgreSQL yang dirancang khusus untuk masalah pemetaan.


Kita bisa gunakan distro Ubuntu atau distro berbasis Debian lainnya. Pertama kita perbaharui dulu daftar paket Debian, mulailah sebagai superuser:

$ sudo su

# apt-get update

Kemudian pasang database server dan paket PostGIS:

# apt-get install postgresql-8.3 postgresql-8.3-postgis

Lanjutkan dengan pembuatan user database, katakanlah bernama tespeta. Anda perlu sebagai user postgres untuk melakukan itu:

# su postgres

$ createuser -P tespeta

Password: ****

Kemudian buatkan tespeta database map:

$ createdb -O tespeta map

Berikutnya pasang PostGIS dalam database map. Ingat, Anda harus tetap sebagai user postgres untuk memasang PostGIS dalam database, karena ada pembuatan function yang mengacu ke C library.

$ createlang plpgsql map

$ psql map -f /usr/share/postgresql-8.3-postgis/lwpostgis.sql

$ psql map -f /usr/share/postgresql-8.3-postgis/spatial_ref_sys.sql

Login-lah ke database map:

$ psql map

Berikan hak akses untuk grup public agar dapat membaca tabel-tabel PostGIS:

GRANT SELECT ON geometry_columns TO public;

GRANT SELECT ON spatial_ref_sys TO public;

Logout dari psql dengan menekan tombol Ctrl-D, dan login-lah sebagai user tespeta:

psql -U tespeta map

Saatnya mencari jarak:

SELECT st_distance(

st_transform(st_pointfromtext(‘POINT(106.832986 -6.369368)’,4269),32661),

st_transform(st_pointfromtext(‘POINT(106.843870 -6.179036)’,4269),32661)




46861.5191828321 (1 row)

Jawaban di atas berarti juga 46,86km.

Tentu dengan menggunakan PHP Anda dapat mengembangkannya menjadi web tool penghitung jarak.

Selamat mencoba dan untuk lebih jelasnya bisa membaca referensinya di

Share :
  • facebook Menghitung Jarak Antara Dua Titik Koordinat Dengan PostGIS
  • twitter Menghitung Jarak Antara Dua Titik Koordinat Dengan PostGIS

240 thoughts on “Menghitung Jarak Antara Dua Titik Koordinat Dengan PostGIS

  1. fake ray bans wayfarer
    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP

    Packers bus henry McCarthy would have one absolutely knack of blunting because while conversing. Whenever your boyfriend’s team victories forward saturday, The Pittsburgh indigenous to become lionized having red these kinds of the path robert Holmgren has been 14 these days. And as a result, But only if kind of, Considering how Lombardi came to be whilst McCarthy during our childhood material in the london..

  2. Pingback: Unlock iPhone Poland

  3. Pingback: Sidewalk

  4. Digital Camera
    Firefox 3.5.3 Firefox 3.5.3 Windows XP Windows XP

    I was suggested this web site by my cousin. I’m not sure whether this post is written by him as nobody else know such detailed about my difficulty. You are incredible! Thanks!

  5. game console
    Internet Explorer 7.0 Internet Explorer 7.0 Windows XP Windows XP

    You actually make it seem so easy with your presentation but I find this topic to be actually something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

  6. wholesale nfl jerseys
    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP

    Midfielder. Although in my opinion, Wilshere and in addition Fabregas enhance additional suitably: Cesc can now pass those bowling ball within stretched but also simple spins around the block, Fresh a strut and can present cockiness at golfing party, Along with passing an understandable inspiration. Wilshere, Instead, Could well spider ago of those that have the pitch upon their own feet, She can one excellent dribbler and create likelihood in the ultimate third, In order with shod and non-shod, They usually have all the bottoms painted.

  7. wholesale nfl jerseys
    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP

    At this point, see this process: Consideration I triumphed in in any time meeting half way on, Or you cannot I begin living, ‘s tough work furthermore robustness. So very is not defense to acquire lf through this category. It is exactly what mafia wars is nearly, And as well, avid wear want to fool around with a person that doesn have that, Coupled with trainers have on want to train all of these.

  8. personalized nfl jerseys
    Internet Explorer 6.0 Internet Explorer 6.0 Windows XP Windows XP

    Here coaches and organizations ultimate have been aquainted with a season in the past the moment the aircraft was lost to tn and gave the and also 10 0 Titans a 34 13 kill. Ohio employs was the winner four of the five support groups, But also tn really are the owners of a 22 16 1 result during in history selection. Football models firms keep posted the big apple aircraft just like a 3 steer most loved with the sum of the now ready via 37..

  9. Cheap Flight Tickets
    Firefox 3.5.3 Firefox 3.5.3 Windows 7 Windows 7

    Great paintings! This is the kind of info that should be shared across the internet. Disgrace on the search engines for now not positioning this submit upper! Come on over and discuss with my website . Thank you =)

  10. Custom Cars
    Firefox 3.5.3 Firefox 3.5.3 Windows 7 Windows 7

    naturally like your web-site but you need to check the spelling on quite a few of your posts. Many of them are rife with spelling problems and I find it very bothersome to inform the reality then again I¡¦ll certainly come back again.

  11. Energy Conservation
    Internet Explorer 7.0 Internet Explorer 7.0 Windows XP Windows XP

    Good site! I truly love how it is simple on my eyes and the data are well written. I’m wondering how I might be notified whenever a new post has been made. I have subscribed to your RSS which must do the trick! Have a great day!

    Internet Explorer 10.0 Internet Explorer 10.0 Windows 7 Windows 7

    Keep your makeup simple: Her day look is absolutely simple and sophisticated
    so she can show off her perfect skin and features.
    It was more than a month before Al and I got back together.
    A more rapid return to “normal” can happen for several reasons.´s last posted

  13. Brooks
    Google Chrome 28.0.1500.71 Google Chrome 28.0.1500.71 GNU/Linux x64 GNU/Linux x64

    Hi, after reading this remarkable article i am too cheerful to
    share my knowledge here with friends.

    My site :: razer keyboard (Brooks)
    Brooks´s last posted Brooks

  14. Antonietta
    Google Chrome 27.0.1453.116 Google Chrome 27.0.1453.116 Mac OS X 10.7.5 Mac OS X 10.7.5

    Are you looking forward angsana riad marrakech dar zaouia
    to spend some quality time together, whether you prefer undersea activities to overwater, whether you are shipping duty-able goods
    or documents with no commercial value. I mean, you can still experience the kind of political uprisings that swept across the rest
    North Africa over the last year. When using the hotel swimming
    pool, make sure you follow the instruction indicated on the product to avoid accidents
    that can lead to dehydration which will only extenuate your problems.

    Feel free to visit my web site: 5 star riad in Marrakech [Antonietta]
    Antonietta´s last posted Antonietta

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CommentLuv badge