Ferry Kurniawan

Every Accomplishment Start With The Decision to Try
See also: Other Geeks@INDC

Display Maps from online WMS Servers

Web Map Service (WMS) adalah protokol standar untuk melayani rujukan geografis gambar peta melalui internet yang dihasilkan oleh server peta menggunakan data dari GIS database. Contoh WMS Server dari negeri sendiri yang bisa anda rujuk adalah :

- WMS Kementrian Kehutanan : http://appgis.dephut.go.id/appgis/

- WMS Kota Samarinda   (Kalimantan Timur) : http://www.samarindacity.com/wms/

Sebagai contoh disini saya akan menampilkan Peta Kota Samarinda melalui WMS nya yang diatas. Untuk menampilkan peta tersebut saya masih menggunakan control ASPMap seperti yang saya tulis disini dan disini.  Untuk detil informasi WMS Kota Samarinda  dapat anda rujuk ke http://www.samarindacity.com/wms/?SERVICE=wms&VERSION=1.1.1&REQUEST=GetCapabilities

Berikut ini langkah-langkahnya menampilkan Peta Kota Samarinda dari WMS Servernya :

1. Buka Visual Studio anda. Buat New Website Beri nama dengan Samarinda. (disini menggunakan VB .Net)

2. Tambahkan control ASPMap dan control ZoomBar ke halaman Default.aspx, Seperti Berikut :

1

3. Ketikkan code berikut ini di Default.aspx.vb   untuk menampilkan petanya ke control Map1

   1: Imports Microsoft.VisualBasic
   2: Imports System
   3: Imports System.Collections
   4: Imports System.ComponentModel
   5: Imports System.Data
   6: Imports System.Data.SqlClient
   7: Imports System.Drawing
   8: Imports System.Web
   9: Imports System.Web.SessionState
  10: Imports System.Web.UI
  11: Imports System.Web.UI.WebControls
  12: Imports System.Web.UI.HtmlControls
  13: Imports AspMap
  14: Imports AspMap.Web
  15: Partial Public Class _Default
  16:     Inherits System.Web.UI.Page
  17:     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  18:         DisplayMap()
  19:     End Sub
  20:     Sub DisplayMap()
  21:         ' akses wms server
  22:         Dim wms As WmsLayer = New WmsLayer("http://www.samarindacity.com/wms/", New AspMap.Rectangle(117.048, 0.319929, 117.302, -0.716833))
  23:         ' menambahkan layer
  24:         wms.AddLayer("kecamatan")
  25:         wms.AddLayer("kelurahan")
  26:         wms.AddLayer("jalan")
  27:         wms.AddLayer("nama_jalan")
  28:  
  29:         wms.ImageFormat = ImageFormat.Png
  30:         ' add the WMS layer to the map
  31:         Dim wmsLayer As AspMap.Layer = Map1.AddLayer(wms)
  32:         ' set the coordinate system of the map to the coordinate system of the TerraServer layer
  33:         Map1.CoordinateSystem = CoordSystem.WGS1984
  34:         ' make the map image transparent to display background WMS layers
  35:         Map1.ImageOpacity = 0
  36:     End Sub
  37: End Class

4. Jalankan halaman tersebut maka akan tampil seperti berikut ini.

2

5. Selamat Mencoba, Terima Kasih & Semoga Bermanfaat :)

6. Source dapat diunduh disini.

Share this post: | | | |

Comments

No Comments