2013年11月10日日曜日

9 - グラフィカルなデータ表示 1 - シェイプファイルの属性

9-1 シェイプファイルの属性の情報の確認
シェイプファイルの属性を使って、グラフィカルなデータ表示をします。

最初に、情報を知るために管理ツールをインストールします。
Synapticパッケージマネージャでgdal-binを検索してインストールします。

mapdataフォルダへ移動し110m_culturalフォルダ内の利用可能なレイヤ名を表示します。

~/mapdata$ ogrinfo 110m_cultural
INFO: Open of `110m_cultural'
      using driver `ESRI Shapefile' successful.
1: ne_110m_admin_0_boundary_lines_land (Line String)
2: ne_110m_populated_places (Point)
3: ne_110m_admin_0_scale_rank (Polygon)
4: ne_110m_admin_0_pacific_groupings (Line String)
5: ne_110m_populated_places_simple (Point)
6: ne_110m_admin_0_tiny_countries (Point)
7: ne_110m_admin_1_states_provinces_lakes_shp (Polygon)
8: ne_110m_admin_1_states_provinces_shp (Polygon)
9: ne_110m_admin_0_sovereignty (Polygon)
10: ne_110m_admin_0_countries_lakes (Polygon)
11: ne_110m_admin_1_states_provinces_shp_scale_rank (Polygon)
12: ne_110m_admin_0_countries (Polygon)
13: ne_110m_admin_0_map_units (Polygon)
14: ne_110m_admin_1_states_provinces_lines (Line String)
次に、populationレイヤのデータを表示します。
~/mapdata$ ogrinfo -summary 110m_cultural ne_110m_admin_0_boundary_lines_land
INFO: Open of `110m_cultural'
      using driver `ESRI Shapefile' successful.
Layer name: ne_110m_admin_0_boundary_lines_land
Geometry: Line String
Feature Count: 185
Extent: (-140.997780, -54.896810) - (141.033852, 70.164190)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.017453292519943295]]
scalerank: Integer (10.0)
featurecla: String (50.0)
name: String (50.0)
name_alt: String (50.0)
~/mapdata$ ogrinfo -summary 110m_cultural ne_110m_admin_0_countries
INFO: Open of `110m_cultural'
      using driver `ESRI Shapefile' successful.

Layer name: ne_110m_admin_0_countries
Geometry: Polygon
Feature Count: 177
Extent: (-180.000000, -90.000000) - (180.000000, 83.645130)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]
scalerank: Integer (4.0)
featurecla: String (30.0)
labelrank: Real (16.6)
sovereignt: String (254.0)
sov_a3: String (254.0)
adm0_dif: Real (16.6)
level: Real (16.6)
type: String (254.0)
admin: String (254.0)
adm0_a3: String (254.0)
geou_dif: Real (16.6)
geounit: String (254.0)
gu_a3: String (254.0)
su_dif: Real (16.6)
subunit: String (254.0)
su_a3: String (254.0)
brk_diff: Real (16.6)
name: String (254.0)
name_long: String (254.0)
brk_a3: String (254.0)
brk_name: String (254.0)
brk_group: String (254.0)
abbrev: String (254.0)
postal: String (254.0)
formal_en: String (254.0)
formal_fr: String (254.0)
note_adm0: String (254.0)
note_brk: String (254.0)
name_sort: String (254.0)
name_alt: String (254.0)
mapcolor7: Real (16.6)
mapcolor8: Real (16.6)
mapcolor9: Real (16.6)
mapcolor13: Real (16.6)
pop_est: Real (16.6)
gdp_md_est: Real (16.6)
pop_year: Real (16.6)
lastcensus: Real (16.6)
gdp_year: Real (16.6)
economy: String (254.0)
income_grp: String (254.0)
wikipedia: Real (16.6)
fips_10: String (254.0)
iso_a2: String (254.0)
iso_a3: String (254.0)
iso_n3: String (254.0)
un_a3: String (254.0)
wb_a2: String (254.0)
wb_a3: String (254.0)
woe_id: Real (16.6)
adm0_a3_is: String (254.0)
adm0_a3_us: String (254.0)
adm0_a3_un: Real (16.6)
adm0_a3_wb: Real (16.6)
continent: String (254.0)
region_un: String (254.0)
subregion: String (254.0)
region_wb: String (254.0)
name_len: Real (16.6)
long_len: Real (16.6)
abbrev_len: Real (16.6)
tiny: Real (16.6)
homepart: Real (16.6)
summaryオプションをつけないとレイヤの詳細すべてを表示します。が、データが多いので国名のオプションをつけて表示します。

~/mapdata$ ogrinfo 110m_cultural ne_110m_admin_0_countries -where "name='Japan'"
INFO: Open of `110m_cultural'
      using driver `ESRI Shapefile' successful.

Layer name: ne_110m_admin_0_countries
Geometry: Polygon
Feature Count: 1
Extent: (-180.000000, -90.000000) - (180.000000, 83.645130)
Layer SRS WKT:
GEOGCS["GCS_WGS_1984",
    DATUM["WGS_1984",
        SPHEROID["WGS_84",6378137.0,298.257223563]],
    PRIMEM["Greenwich",0.0],
    UNIT["Degree",0.0174532925199433]]
scalerank: Integer (4.0)
featurecla: String (30.0)
labelrank: Real (16.6)
sovereignt: String (254.0)
sov_a3: String (254.0)
adm0_dif: Real (16.6)
level: Real (16.6)
type: String (254.0)
admin: String (254.0)
adm0_a3: String (254.0)
geou_dif: Real (16.6)
geounit: String (254.0)
gu_a3: String (254.0)
su_dif: Real (16.6)
subunit: String (254.0)
su_a3: String (254.0)
brk_diff: Real (16.6)
name: String (254.0)
name_long: String (254.0)
brk_a3: String (254.0)
brk_name: String (254.0)
brk_group: String (254.0)
abbrev: String (254.0)
postal: String (254.0)
formal_en: String (254.0)
formal_fr: String (254.0)
note_adm0: String (254.0)
note_brk: String (254.0)
name_sort: String (254.0)
name_alt: String (254.0)
mapcolor7: Real (16.6)
mapcolor8: Real (16.6)
mapcolor9: Real (16.6)
mapcolor13: Real (16.6)
pop_est: Real (16.6)
gdp_md_est: Real (16.6)
pop_year: Real (16.6)
lastcensus: Real (16.6)
gdp_year: Real (16.6)
economy: String (254.0)
income_grp: String (254.0)
wikipedia: Real (16.6)
fips_10: String (254.0)
iso_a2: String (254.0)
iso_a3: String (254.0)
iso_n3: String (254.0)
un_a3: String (254.0)
wb_a2: String (254.0)
wb_a3: String (254.0)
woe_id: Real (16.6)
adm0_a3_is: String (254.0)
adm0_a3_us: String (254.0)
adm0_a3_un: Real (16.6)
adm0_a3_wb: Real (16.6)
continent: String (254.0)
region_un: String (254.0)
subregion: String (254.0)
region_wb: String (254.0)
name_len: Real (16.6)
long_len: Real (16.6)
abbrev_len: Real (16.6)
tiny: Real (16.6)
homepart: Real (16.6)
OGRFeature(ne_110m_admin_0_countries):82
  scalerank (Integer) = 1
  featurecla (String) = Admin-0 country
  labelrank (Real) =         2.000000
  sovereignt (String) = Japan
  sov_a3 (String) = JPN
  adm0_dif (Real) =         0.000000
  level (Real) =         2.000000
  type (String) = Sovereign country
  admin (String) = Japan
  adm0_a3 (String) = JPN
  geou_dif (Real) =         0.000000
  geounit (String) = Japan
  gu_a3 (String) = JPN
  su_dif (Real) =         0.000000
  subunit (String) = Japan
  su_a3 (String) = JPN
  brk_diff (Real) =         0.000000
  name (String) = Japan
  name_long (String) = Japan
  brk_a3 (String) = JPN
  brk_name (String) = Japan
  brk_group (String) = (null)
  abbrev (String) = Japan
  postal (String) = J
  formal_en (String) = Japan
  formal_fr (String) = (null)
  note_adm0 (String) = (null)
  note_brk (String) = (null)
  name_sort (String) = Japan
  name_alt (String) = (null)
  mapcolor7 (Real) =         5.000000
  mapcolor8 (Real) =         3.000000
  mapcolor9 (Real) =         5.000000
  mapcolor13 (Real) =         4.000000
  pop_est (Real) = 127078679.000000
  gdp_md_est (Real) =   4329000.000000
  pop_year (Real) =       -99.000000
  lastcensus (Real) =      2010.000000
  gdp_year (Real) =       -99.000000
  economy (String) = 1. Developed region: G7
  income_grp (String) = 1. High income: OECD
  wikipedia (Real) =       -99.000000
  fips_10 (String) = (null)
  iso_a2 (String) = JP
  iso_a3 (String) = JPN
  iso_n3 (String) = 392
  un_a3 (String) = 392
  wb_a2 (String) = JP
  wb_a3 (String) = JPN
  woe_id (Real) =       -99.000000
  adm0_a3_is (String) = JPN
  adm0_a3_us (String) = JPN
  adm0_a3_un (Real) =       -99.000000
  adm0_a3_wb (Real) =       -99.000000
  continent (String) = Asia
  region_un (String) = Asia
  subregion (String) = Eastern Asia
  region_wb (String) = East Asia & Pacific
  name_len (Real) =         5.000000
  long_len (Real) =         5.000000
  abbrev_len (Real) =         5.000000
  tiny (Real) =       -99.000000
  homepart (Real) =         1.000000
  MULTIPOLYGON (((134.638428176003885 ...[続く]
このうち、pop_estが総人口です。

0 件のコメント: