7. 台灣最常⽤用的座標參考系統
The most Common CRS in Taiwan
Geographic coordinate system
• WGS84(Lat/Lon)
Projected Coordinate System
• TWD67 ( TM2 )、TWD97 ( TM2 )
The image above using Mercator Projection, but TM2 using Transverse Mercator ProjectionNote:
9. 分辨⼿手上的資料是TM⼆二度分帶(TWD67 or 97)或經緯度座標
Distinguish which CRS of your Data
Before processing your data, you should know the CRS
of your dara.
You can do the following if you are not sure:
TM2 or Lat/Lon?
• If the numbers is bigger your data must be TM2.
TWD97( TM2 ) or TWD67( TM2 )?
• Normally, It’s TWD97 data, unless you get that earlier than
1999 ( 921 Jiji earthquake ).
10. 台灣常⽤用的座標參考系統
More About Common CRS Used in Taiwan
• http://www.sunriver.com.tw/grid_tm2.htm
A website explaining the details of common
CRS Used in Taiwan
11. Shapefile的結構
The Structure of Shapefile
• Shapefile save numerical data and text data in dBase(.dbf) file.
• Shapefile save shapes and positions in .shp file.
• and .shx save index, .prj save projection information.
12. 讓我們快速的匯入台灣村⾥里界圖!
Let’s Quickly Import Our Data
%pylab inline
pylab.rcParams['figure.figsize'] = (20.0, 20.0)
import geopandas as gpd
import shapely
villages_shp = gpd.read_file('./台灣⾥里界圖_TWD97/
Village_NLSC_121_1050219.shp')
Import the geoPandas, and setting ipython notebook to
plot map more beautifully.
Import a shapefile.
21. 使⽤用⼩小資料練習Pandas及GeoPandas
Practice Pandas and GeoPandas with Small Data!
villages_shp = gpd.read_file(
‘./台灣⾥里界圖_TWD97/Village_NLSC_121_1050219.shp
)
Import a shapefile:
census_villages = pd.read_csv(
'Data/104年12⽉月⼈人⼝口數.csv', skiprows=[0]
)
Load census data:
42. 忠孝橋引道問題
Zhongxiao Bridge’s Problem
Approach road to Zhongxiao Bridge
Select the
Approach road
Calculate the zone of
influence
Find the Villages
which be influenced
Buffer IntersectionFine “忠孝重慶” int.
and “忠孝環河" int.
43. roads = gpd.read_file('./Taiwan Road’)
匯入台灣道路資料
Import Roads’ Data
roads = roads.to_crs(epsg=3826)
Import Taiwan’s Roads:
To Calculate, We Should Project Our GeoDataframe to
TWD97(Epsg code: 3826)
47. Fine “忠孝重慶” int. and “忠孝環河" int.
忠孝重慶int = 忠孝路.unary_union.intersection(
重慶路.unary_union
).centroid
忠孝環河int = 忠孝路.unary_union.intersection(
環河路.unary_union
).centroid
48. 忠孝重慶int.x , 忠孝重慶int.y
We Get the Easternmost Position of “Approach road to
Zhongxiao Bridge”
忠孝環河int.x , 忠孝環河int.y
… and the Easternmost Position of “Approach road to
Zhongxiao Bridge”
Ouput: (301790.13325580396, 2771103.9320118735)
Output: (301073.18135184597, 2771299.2108038645)
50. 畫出影響範圍
Calculate the Zone of Influence
忠孝橋引道buffer =
gpd.GeoSeries(忠孝橋引道.unary_union.buffer(500))
ax = 忠孝橋引道buffer.plot()
忠孝橋引道.plot(ax=ax, linewidth=4)
53. 找出各⾥里實際於影響區內的區域
Find the Influenced Part in the Villages
influences_villages_shp_clip =
influences_villages_shp.copy()
influences_villages_shp_clip['geometry'] =
influences_villages_shp_clip.intersection(
忠孝橋引道buffer.unary_union
)