2008年5月30日

Blog Post with Word 2007

剛剛發現可以直接利用Office 2007於blogger上進行貼文,如此一來可以更方便大家進行知識交流的工作,不需要特別在網路上打字,只需要透過原來熟悉的Word的編輯,將自己手邊的研究,放在這裡與大家分享,並可在自身電腦有份備份,以下為設定方式:

步驟一: 進到Publish 裡的Blog,裡頭就會看到位置,橫線上方為文章標題,下方則為文章,編輯方式與一般於Word裡頭相同


步驟二:完成後,按左上方的Publish,裡頭會要求你設定blog server以及picture server,

  1. 將blog server設定為blogger,以及使用您的google或是研究室帳號登入
  2. 將picture server中Upload Url以及Source Url皆為研究室ftp server,位置為ftp://140.112.190.162/blog,使用者為匿名(anonymous),密碼為空白。設定完成後,即可貼文。


 

MATLAB 之工程應用

http://bime-matlab.blogspot.com/

http://www.mathworks.com/

一些幫助初學者學習matlab的網路資源,在學習matlab的學弟妹們可多加利用參考。:)

From Shummi  

GIS programming learning resources

  1. A UNC class website by Dr. Liang
  2. A class from Colorado state by Dr. Leyk
  3. A class from U of Colorado by Dr. Sambrook
  4. A python GIS class from U of Washington
  5. ArcGIS Help in Geoprocessing script

VBA
  1. VBA with ArcObjects
  2. VBA ArcGIS Environment
  3. 空間資訊與程式設計
ArcObjects Online
ArcGIS Developer Online

Introduction to GIS lectures

  1. Introduction to GIS by Dr. Kumar in Dept of Ecosystem management in U of New England, AU
  2. GIS I: by Dr. Duh in Dept of Geography in Portland State University, USA with textbook Geographic Information Systems and Science by Drs. Longley, Goodchild, Maguire, Rhind
  3. GIS application II by Dr. Duh in Dept of Geography in Portland State University, USA

GIS softwares

  1. Xtoolspro is a shareware for ArcGIS which provides many useful functionality addition to the original ArcGIS functions.
  2. SaTScan: A free software that analyzes spatial, temporal and space-time data using the spatial, temporal, or space-time scan statistics.

GIS resources

  1. Few ArcGIS Notes from a website of a doctoral student in NTU
  2. Taiwan GIS resources from a class document in 2008 spring
  3. GIS resources page from Duke university which has a very well-organized with simple description and links
  4. Computer Geography page from Ireland which provides some lecture notes about Computational Geography (such as small area problem and Spatial analyst) and also many useful GIS resources.

Projection transformation

It has been confused me for a while. How to define or transform the projection of a shapefile in ArcGIS such that it can align with other maps with different coordinate system. Here is the steps in ArcGIS 9.X.
  1. Figure out the original projection of your map even though it has not been defined before, namely it does not have any projection file (*.prj) along with other files for shapefile.
  2. Two coordinate system can be defined in a shapefile, one is geographical coordinate system which is essentially for longitude and latitude; the other one is projected coordinate system which is for the planar coordinate (two-dimension)
  3. To define a coordinate system to a shapefile, Go to ArcToolbox -> Data Management Tools -> Projections and transformations -> Define projection, and then a window will popup for us to select the shapefile (feature class) to define and the coordinate system
  4. To change a coordinate system of a shapefile in order to align with other shapefile,
    1. Determine the coordinate system to which we would like to transform
    2. Go to ArcToolbox -> Data Management Tools -> Projections and transformations ->Feature -> Project
    3. Specify the shapefile to transform (feature class), the name for the new shapefile with new coordinate system (projection), and the new coordinate system in the popup window
    4. OK
  5. The new shapefile will automatically be added into the current project
  6. Note that the table of the new shapefile is exactly the same as the original shapefile. The new geometry values upon the new coordinate system can be generated by adding new field in the Table and do the Geometry calculation.

To adjust the position of maps in ArcGIS

Here I encounter an interesting problem that two Taiwan shapefile with two different administrative units can not completely overlay to each other (shown in the first figure below). It confused me a lot and made me think that the projection definition can be an issue for these maps. Some solution for the change of projection system in ArcGIS is discussed in this document. The projection definition indeed has some issue in Taiwan area where several definitions exist concurrently and are inconsistent. For the detail information about the projection issue in Taiwan.
  1. Introduction to projection system and definition of two-degree transverse Mercator (二度分帶)
  2. The webpage for the description the three common Transverse Mercator system TWD67 (Taiwan Datum 67), TWD97 (Taiwan Datum 97), WGS84 (World Geodetic system 84)
  3. A very informative educational website
  4. Projection system transformation
However, in fact, the solution of the displacement of these two shapefiles in ArcGIS does not have anything to do with the coordinate systems, according to the experience drawn from the trials by myself and my student. Here is the solution to adjust the map proposed by Chi-Shih
  1. 開啟arcmap選擇a new empty map
  2. 看到一個黃色+號圖形,把這三張圖讀出
  3. toolseditor bars→會出現編輯的工具列
  4. editorstart editing→就可以開始編輯
  5. 先打勾里村跟縣市(或鄉鎮)作對比
  6. 看完對比之後,只那村里勾選→用滑鼠把外島那一部份框起來,移至最左邊,不要擋到其它那兩張圖外島的位置就行了
  7. 然後勾選其它兩張任一張圖,做對比→一一的移動到適當的位置
  8. 完成了之後,到editorstop editing→它會問要不要存檔→ok→即完成


Extract points from polyline in ArcGIS

Here is a visual basic macro for ArcGIS to generate points on the polylines. How to use these codes. Few steps are discussed below:
  1. Add the polyline shapefile in your ArcMap project.
  2. Create a point shapefile in ArcCatalog by right-click a specific folder and select New to create a new point shapefile in which the to-be-generated points will be saved.
  3. In ArcMap, Go to Tool > Macro > Visual Basic Editor > Project > ArcMap Objects > ThisDocument
  4. Copy the VB script attached below and paste into ThisDocument
  5. Highlight the polyline shapefile to be extracted
  6. Click the "Run Sub" button to execute the script
  7. Done !!
----------------------------------------------------
Public Sub CreatePointsAlongCurve()
'Creates points at a set distance along any feature implementing ICurve
'
'Justin Johnson
'January 23, 2004
'justin.johnson@geog.utah.edu
'
'Obtains selected features from currently-selected Layer
'Stores new points in point theme at top of TOC

Dim pMxDoc As IMxDocument
Dim pMap As IMap
Dim pInGeometry As IGeometry
Dim pInLayer As ILayer
Dim pInFLayer As IFeatureLayer
Dim pOutFLayer As IFeatureLayer
Dim pInFCursor As IFeatureCursor
Dim pOutFCursor As IFeatureCursor
Dim pOutFBuffer As IFeatureBuffer
Dim pInFClass As IFeatureClass
Dim pOutFClass As IFeatureClass
Dim pSelSet As ISelectionSet
Dim pFSelection As IFeatureSelection
Dim pInFeature As IFeature
Dim pCurve As ICurve
Dim pPointCollection As IPointCollection
Dim pConstructMultipoint As IConstructMultipoint

Set pMxDoc = ThisDocument
Set pMap = pMxDoc.FocusMap
Set pInLayer = pMxDoc.SelectedLayer

If pInLayer Is Nothing Then 'Check if no input layer is selected
MsgBox "Select a feature layer in the TOC", vbCritical, "Incompatible input layer"
Exit Sub
End If

If TypeOf pInLayer Is IFeatureLayer Then 'check if selected layer is a feature layer
Set pInFLayer = pMxDoc.SelectedLayer 'set selected layer as input feature layer
Else
MsgBox "Select a feature layer in the TOC", vbCritical, "Incompatible input layer"
Exit Sub
End If

Set pOutFLayer = pMap.Layer(0) ' set top layer in TOC as output feature layer
Set pInFClass = pInFLayer.FeatureClass
Set pOutFClass = pOutFLayer.FeatureClass

If Not pOutFClass.ShapeType = esriGeometryPoint Then 'check if output layer is Point type
MsgBox "Geometry type of output layer is not Point", vbCritical, "Incompatible Output Layer"
Exit Sub
End If

'Get selected features, if any
Set pFSelection = pInFLayer
Set pSelSet = pFSelection.SelectionSet

'Prompt user for distance between points
Dim pPointDist As Double
pPointDist = InputBox("Distance between points: ", "Point Spacing in Map Units")

'Create an Insert cursor on output feature class
Set pOutFBuffer = pOutFClass.CreateFeatureBuffer
Set pOutFCursor = pOutFClass.Insert(True)

If pSelSet.Count <> 0 Then
'use selected features from input feature class
pFSelection.SelectionSet.Search Nothing, True, pInFCursor
Else
'use all features if none are selected
Set pInFCursor = pInFClass.Search(Nothing, True)
End If

Dim k As Long 'count the number of points created
k = 0

Set pInFeature = pInFCursor.NextFeature

Do While Not pInFeature Is Nothing

Set pInGeometry = pInFeature.Shape
Set pCurve = pInGeometry
Set pConstructMultipoint = New Multipoint

pConstructMultipoint.ConstructDivideLength pCurve, pPointDist

Set pPointCollection = pConstructMultipoint

Dim i As Long
For i = 0 To pPointCollection.PointCount - 1

Set pOutFBuffer.Shape = pPointCollection.Point(i) 'store the new geometry
pOutFCursor.InsertFeature pOutFBuffer
k = k + 1

Next i

Set pInFeature = pInFCursor.NextFeature

Loop

pMxDoc.ActiveView.Refresh
MsgBox k & " points created in " & pOutFLayer.Name, vbInformation, "Complete"

End Sub

Load DEM into ArcGIS

I download the DEM (Digital Elevation Model) files from Geocommunity to do the exercise of Archydro model to analysis DEM file for the collection of geographical information. Geocommunity is the free port providing the free GIS files from all over the world. Its format of DEM files is SDTS (Spatial Data Transfer Standard). In order to transfrom the SDTS file into the suitable format for ArcGIS 9.2 use, we should add the new extension by going to ArcCatalog->Tools-> Customize-> Arcview 8x tools.
The transformation of SDTS file to Grid file for the DEM analysis, it follows the steps
  1. Open ArcToolbox
  2. Under Conversion Tools > Import to Raster, choose 'SDTS Raster to Grid'
  3. In the Input Prefix box, navigate to the folder with the ****.ddf files, and choose the 4 digit input file (ex:1158). Note that the path for the .ddf files may not contain any spaces.
  4. Choose the Z-value field name for the Record No. box, i.e. "ELEVATION".
  5. Select an output folder and name the Grid.
  6. Keep Convert Values and Use Data Dictionary checked.
  7. Hit OK.
  8. You may then add this DEM Grid to ArcInfo Desktop or ArcView 3.x
For more comprehensive information, we can go to the website.

How to merge polygon in ArcGIS?

Case 1: Automatically merge all small polygons into a big one with respect to a specified attribute.
We can refer to the dissolve function in ArcToolbox.

Case 2: If the two specific polygons are expected to merge, follow the steps as follows
a. Select Editor > Start Editing.
b. Toggle the original polygon layer invisible.
c. Select the polygon features from the new polygon layer to be merged.
d. Select Editor > Merge.
e. The Merge dialog lists the polygon features to be merged. Click OK to merge the polygons features.
f. Select Editor > Stop Editing and click Yes to save the edits.

For more info, we can refer to the ESRI website

One note:
The dissolve function in ArcGIS 9.2 is not as capable as it was in Arcview 3.2. The dissolve function can experience memory limitation difficulty once the shapefile is too big. The workaround for the polygon dissolving is the usage of Arcview 3.2 geoprocessing wizard.

2008年5月29日

Welcome to STEMLAB Blog

研究室 blog 誕生
希望本blog為本研究室為本研究室所有成員的園地
在研究的過程中,會發現很多時候我們都在做著前人做過重複的事情,上google找資訊,找學長姐,為了讓我們省下循著前人足跡摸索的時間,希望大家都可以把你研究的一點一滴,新發現,把他貼上來,幫助自己也幫助大家,讓大家一起成長,省下的時間一起去玩 :-D

當然也歡迎貼上心得與問題,藉由這個空間來討論與分享

研究室blog公用帳號 stemlab01@gmail.com 密碼: ntustemlab
研究室FTP公用帳號 stemlab 密碼: stemlab