shapelib 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/shapelib.gemspec ADDED
@@ -0,0 +1,58 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+ # stub: shapelib 0.7.2 ruby lib
6
+ # stub: ext/shapelib_ext/extconf.rb
7
+
8
+ Gem::Specification.new do |s|
9
+ s.name = "shapelib".freeze
10
+ s.version = "0.7.2"
11
+
12
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
13
+ s.require_paths = ["lib".freeze]
14
+ s.authors = ["prasinos@users.sourceforge.net".freeze, "Mike Mangino".freeze, "Mike Perham".freeze, "Nick Estes".freeze]
15
+ s.date = "2026-10-14"
16
+ s.description = "Simple wrapper around the shapelib library".freeze
17
+ s.email = "nick@nickstoys.com".freeze
18
+ s.extensions = ["ext/shapelib_ext/extconf.rb".freeze]
19
+ s.extra_rdoc_files = [
20
+ "README.md"
21
+ ]
22
+ s.files = [
23
+ "README.md",
24
+ "Rakefile",
25
+ "doc/Interface.html",
26
+ "doc/Interface.rd",
27
+ "doc/style.css",
28
+ "ext/shapelib_ext/depend",
29
+ "ext/shapelib_ext/extconf.rb",
30
+ "ext/shapelib_ext/main.c",
31
+ "ext/shapelib_ext/sfcode.h",
32
+ "ext/shapelib_ext/sflist.h",
33
+ "ext/shapelib_ext/shpplus.c",
34
+ "ext/shapelib_ext/shpplus.h",
35
+ "ext/shapelib_ext/spcode.h",
36
+ "ext/shapelib_ext/splist.h",
37
+ "ext/shapelib_ext/spwkt.h",
38
+ "ext/shapelib_ext/valconv.h",
39
+ "lib/shapelib.rb",
40
+ "lib/shapelib/shape.rb",
41
+ "lib/shapelib/version.rb",
42
+ "shapelib.gemspec",
43
+ "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.dbf",
44
+ "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.prj",
45
+ "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shp",
46
+ "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shp.xml",
47
+ "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shx",
48
+ "test/test_zillow_data.rb"
49
+ ]
50
+ s.homepage = "http://github.com/mperham/shapelib".freeze
51
+ s.rubygems_version = "3.4.20".freeze
52
+ s.summary = "Simple wrapper around the shapelib library".freeze
53
+
54
+ s.specification_version = 4
55
+
56
+ s.add_development_dependency(%q<rake-compiler>.freeze, [">= 0.7.0"])
57
+ end
58
+
@@ -0,0 +1 @@
1
+ GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0"?>
2
+ <!--<!DOCTYPE metadata SYSTEM "http://www.esri.com/metadata/esriprof80.dtd">-->
3
+ <metadata xml:lang="en"><Esri><MetaID>{63D678E6-82E9-4F47-A156-84E301C42FEF}</MetaID><CreaDate>20071221</CreaDate><CreaTime>17373300</CreaTime><SyncOnce>FALSE</SyncOnce><SyncDate>20071221</SyncDate><SyncTime>17373300</SyncTime><ModDate>20071221</ModDate><ModTime>17373300</ModTime></Esri><idinfo><native Sync="TRUE">Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 2; ESRI ArcCatalog 9.2.0.1324</native><descript><langdata Sync="TRUE">en</langdata><abstract>Neighborhood boundaries for large cities in California. This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License. You are free to Share - to copy, distribute and transmit the work. You are free to adapt the work. You must attribute the work in the manner specified by the author or licensor. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. http://creativecommons.org/licenses/by-sa/3.0</abstract><purpose>Displaying neighborhoods. Organizing and aggregating geographic and point level data based on neighborhoods.</purpose></descript><citation><citeinfo><origin>Zillow.com compiled this data with the help of municipalities throughout the US.</origin><pubdate>20071001</pubdate><title Sync="FALSE">Neighborhood Boundaries in California</title><geoform Sync="TRUE">vector digital data</geoform><onlink Sync="FALSE">http://www.zillow.com/</onlink></citeinfo></citation><timeperd><current>Current as of 2007</current><timeinfo><sngdate><caldate>2007</caldate></sngdate></timeinfo></timeperd><status><progress>More neighborhoods will continue to be added to this data set.</progress><update>Roughly once per quarter.</update></status><spdom><bounding><westbc Sync="TRUE">-122.514493</westbc><eastbc Sync="TRUE">-116.908818</eastbc><northbc Sync="TRUE">38.685285</northbc><southbc Sync="TRUE">32.534855</southbc></bounding><lboundng><leftbc Sync="TRUE">-122.514493</leftbc><rightbc Sync="TRUE">-116.908818</rightbc><bottombc Sync="TRUE">32.534855</bottombc><topbc Sync="TRUE">38.685285</topbc></lboundng></spdom><keywords><theme><themekt>None</themekt><themekey>shape</themekey><themekey>neighborhood</themekey><themekey>polygon</themekey><themekey>boundaries</themekey></theme><place><placekt>None</placekt><placekey>United States</placekey><placekey>California</placekey><placekey>Neighborhoods</placekey></place></keywords><accconst><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br />This <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/" rel="dc:type">work</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>. http://creativecommons.org/licenses/by-sa/3.0</accconst><useconst><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/88x31.png" /></a><br />This <span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/" rel="dc:type">work</span> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>. http://creativecommons.org/licenses/by-sa/3.0</useconst><natvform Sync="TRUE">Shapefile</natvform></idinfo><dataIdInfo><envirDesc Sync="TRUE">Microsoft Windows XP Version 5.1 (Build 2600) Service Pack 2; ESRI ArcCatalog 9.2.0.1324</envirDesc><dataLang><languageCode Sync="TRUE" value="en"></languageCode></dataLang><idCitation><resTitle Sync="TRUE">ZillowNeighborhoods-CA</resTitle><presForm><PresFormCd Sync="TRUE" value="005"></PresFormCd></presForm></idCitation><spatRpType><SpatRepTypCd Sync="TRUE" value="001"></SpatRepTypCd></spatRpType><dataExt><geoEle><GeoBndBox esriExtentType="native"><westBL Sync="TRUE">-122.514493</westBL><eastBL Sync="TRUE">-116.908818</eastBL><northBL Sync="TRUE">38.685285</northBL><southBL Sync="TRUE">32.534855</southBL><exTypeCode Sync="TRUE">1</exTypeCode></GeoBndBox></geoEle></dataExt><geoBox esriExtentType="decdegrees"><westBL Sync="TRUE">-122.514493</westBL><eastBL Sync="TRUE">-116.908818</eastBL><northBL Sync="TRUE">38.685285</northBL><southBL Sync="TRUE">32.534855</southBL><exTypeCode Sync="TRUE">1</exTypeCode></geoBox></dataIdInfo><metainfo><langmeta Sync="TRUE">en</langmeta><metstdn Sync="TRUE">FGDC Content Standards for Digital Geospatial Metadata</metstdn><metstdv Sync="TRUE">FGDC-STD-001-1998</metstdv><mettc Sync="TRUE">local time</mettc><metextns><onlink Sync="TRUE">http://www.esri.com/metadata/esriprof80.html</onlink><metprof Sync="TRUE">ESRI Metadata Profile</metprof></metextns><metc><cntinfo><cntorgp><cntper>Tommy Unger</cntper><cntorg>Zillow.com</cntorg></cntorgp><cntaddr><addrtype>999 Third AVE, Suite 4600</addrtype><city>Seattle</city><state>WA</state><postal>98104</postal></cntaddr><cntvoice>206-470-7000</cntvoice></cntinfo></metc><metd Sync="TRUE">20071221</metd></metainfo><mdLang><languageCode Sync="TRUE" value="en"></languageCode></mdLang><mdStanName Sync="TRUE">ISO 19115 Geographic Information - Metadata</mdStanName><mdStanVer Sync="TRUE">DIS_ESRI1.0</mdStanVer><mdChar><CharSetCd Sync="TRUE" value="004"></CharSetCd></mdChar><mdHrLv><ScopeCd Sync="TRUE" value="005"></ScopeCd></mdHrLv><mdHrLvName Sync="TRUE">dataset</mdHrLvName><distinfo><resdesc Sync="TRUE">Downloadable Data</resdesc><stdorder><digform><digtinfo><transize Sync="TRUE">1.537</transize><dssize Sync="TRUE">1.537</dssize></digtinfo></digform></stdorder></distinfo><distInfo><distributor><distorTran><transSize Sync="TRUE">1.537</transSize></distorTran><distorFormat><formatName Sync="TRUE">Shapefile</formatName></distorFormat></distributor></distInfo><spdoinfo><direct Sync="TRUE">Vector</direct><ptvctinf><esriterm Name="ZillowNeighborhoods-CA"><efeatyp Sync="TRUE">Simple</efeatyp><efeageom Sync="TRUE">Polygon</efeageom><esritopo Sync="TRUE">FALSE</esritopo><efeacnt Sync="TRUE">948</efeacnt><spindex Sync="TRUE">FALSE</spindex><linrefer Sync="TRUE">FALSE</linrefer></esriterm><sdtsterm Name="ZillowNeighborhoods-CA"><sdtstype Sync="TRUE">G-polygon</sdtstype><ptvctcnt Sync="TRUE">948</ptvctcnt></sdtsterm></ptvctinf></spdoinfo><spref><horizsys><cordsysn><geogcsn Sync="TRUE">GCS_North_American_1983</geogcsn></cordsysn><geograph><geogunit Sync="TRUE">Decimal degrees</geogunit><latres Sync="TRUE">0.000000</latres><longres Sync="TRUE">0.000000</longres></geograph><geodetic><horizdn Sync="TRUE">North American Datum of 1983</horizdn><ellips Sync="TRUE">Geodetic Reference System 80</ellips><semiaxis Sync="TRUE">6378137.000000</semiaxis><denflat Sync="TRUE">298.257222</denflat></geodetic></horizsys></spref><refSysInfo><RefSystem><refSysID><identCode Sync="TRUE">GCS_North_American_1983</identCode></refSysID></RefSystem></refSysInfo><spatRepInfo><VectSpatRep><topLvl><TopoLevCd Sync="TRUE" value="001"></TopoLevCd></topLvl><geometObjs Name="ZillowNeighborhoods-CA"><geoObjTyp><GeoObjTypCd Sync="TRUE" value="001"></GeoObjTypCd></geoObjTyp><geoObjCnt Sync="TRUE">948</geoObjCnt></geometObjs></VectSpatRep></spatRepInfo><eainfo><detailed Name="ZillowNeighborhoods-CA"><enttyp><enttypl Sync="TRUE">ZillowNeighborhoods-CA</enttypl><enttypt Sync="TRUE">Feature Class</enttypt><enttypc Sync="TRUE">948</enttypc></enttyp><attr><attrlabl Sync="TRUE">FID</attrlabl><attalias Sync="TRUE">FID</attalias><attrtype Sync="TRUE">OID</attrtype><attwidth Sync="TRUE">4</attwidth><atprecis Sync="TRUE">0</atprecis><attscale Sync="TRUE">0</attscale><attrdef Sync="TRUE">Internal feature number.</attrdef><attrdefs Sync="TRUE">ESRI</attrdefs><attrdomv><udom Sync="TRUE">Sequential unique whole numbers that are automatically generated.</udom></attrdomv></attr><attr><attrlabl Sync="TRUE">Shape</attrlabl><attalias Sync="TRUE">Shape</attalias><attrtype Sync="TRUE">Geometry</attrtype><attwidth Sync="TRUE">0</attwidth><atprecis Sync="TRUE">0</atprecis><attscale Sync="TRUE">0</attscale><attrdef Sync="TRUE">Feature geometry.</attrdef><attrdefs Sync="TRUE">ESRI</attrdefs><attrdomv><udom Sync="TRUE">Coordinates defining the features.</udom></attrdomv></attr><attr><attrlabl Sync="TRUE">STATE</attrlabl><attalias Sync="TRUE">STATE</attalias><attrtype Sync="TRUE">String</attrtype><attwidth Sync="TRUE">2</attwidth></attr><attr><attrlabl Sync="TRUE">COUNTY</attrlabl><attalias Sync="TRUE">COUNTY</attalias><attrtype Sync="TRUE">String</attrtype><attwidth Sync="TRUE">43</attwidth></attr><attr><attrlabl Sync="TRUE">CITY</attrlabl><attalias Sync="TRUE">CITY</attalias><attrtype Sync="TRUE">String</attrtype><attwidth Sync="TRUE">64</attwidth></attr><attr><attrlabl Sync="TRUE">NAME</attrlabl><attalias Sync="TRUE">NAME</attalias><attrtype Sync="TRUE">String</attrtype><attwidth Sync="TRUE">64</attwidth></attr><attr><attrlabl Sync="TRUE">REGIONID</attrlabl><attalias Sync="TRUE">REGIONID</attalias><attrtype Sync="TRUE">Number</attrtype><attwidth Sync="TRUE">32</attwidth><atnumdec Sync="TRUE">10</atnumdec></attr></detailed></eainfo><mdDateSt Sync="TRUE">20071221</mdDateSt></metadata>
@@ -0,0 +1,17 @@
1
+ require 'shapelib'
2
+ require 'test/unit'
3
+
4
+ class TestZillowData < Test::Unit::TestCase
5
+
6
+ def test_file_loading
7
+ filename = "test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA"
8
+ file = Shapelib::ShapeFile.open(filename)
9
+
10
+ assert_equal 948, file.size
11
+ file.each do |shape|
12
+ p shape
13
+ end
14
+ ensure
15
+ file.close if file
16
+ end
17
+ end
metadata CHANGED
@@ -1,48 +1,40 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: shapelib
3
- version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 7
8
- - 0
9
- version: 0.7.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.2
10
5
  platform: ruby
11
- authors:
6
+ authors:
12
7
  - prasinos@users.sourceforge.net
13
8
  - Mike Mangino
14
9
  - Mike Perham
15
- autorequire:
10
+ - Nick Estes
11
+ autorequire:
16
12
  bindir: bin
17
13
  cert_chain: []
18
-
19
- date: 2010-07-09 00:00:00 -07:00
20
- default_executable:
21
- dependencies:
22
- - !ruby/object:Gem::Dependency
14
+ date: 2026-10-14 00:00:00.000000000 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
23
17
  name: rake-compiler
24
- prerelease: false
25
- requirement: &id001 !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
18
+ requirement: !ruby/object:Gem::Requirement
19
+ requirements:
28
20
  - - ">="
29
- - !ruby/object:Gem::Version
30
- segments:
31
- - 0
32
- - 7
33
- - 0
21
+ - !ruby/object:Gem::Version
34
22
  version: 0.7.0
35
23
  type: :development
36
- version_requirements: *id001
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: 0.7.0
37
30
  description: Simple wrapper around the shapelib library
38
- email: mmangino@elevatedrails.com
31
+ email: nick@nickstoys.com
39
32
  executables: []
40
-
41
- extensions:
33
+ extensions:
42
34
  - ext/shapelib_ext/extconf.rb
43
- extra_rdoc_files:
35
+ extra_rdoc_files:
44
36
  - README.md
45
- files:
37
+ files:
46
38
  - README.md
47
39
  - Rakefile
48
40
  - doc/Interface.html
@@ -62,42 +54,33 @@ files:
62
54
  - lib/shapelib.rb
63
55
  - lib/shapelib/shape.rb
64
56
  - lib/shapelib/version.rb
65
- - test/libtest.rb
66
- - test/zsample1.rb
67
- - test/ztest1.rb
68
- has_rdoc: true
57
+ - shapelib.gemspec
58
+ - test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.dbf
59
+ - test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.prj
60
+ - test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shp
61
+ - test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shp.xml
62
+ - test/data/ZillowNeighborhoods-CA/ZillowNeighborhoods-CA.shx
63
+ - test/test_zillow_data.rb
69
64
  homepage: http://github.com/mperham/shapelib
70
65
  licenses: []
71
-
72
- post_install_message:
73
- rdoc_options:
74
- - --charset=UTF-8
75
- require_paths:
66
+ metadata: {}
67
+ post_install_message:
68
+ rdoc_options: []
69
+ require_paths:
76
70
  - lib
77
- required_ruby_version: !ruby/object:Gem::Requirement
78
- none: false
79
- requirements:
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
80
73
  - - ">="
81
- - !ruby/object:Gem::Version
82
- segments:
83
- - 0
84
- version: "0"
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- none: false
87
- requirements:
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
88
78
  - - ">="
89
- - !ruby/object:Gem::Version
90
- segments:
91
- - 0
92
- version: "0"
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
93
81
  requirements: []
94
-
95
- rubyforge_project:
96
- rubygems_version: 1.3.7
97
- signing_key:
98
- specification_version: 3
82
+ rubygems_version: 3.4.20
83
+ signing_key:
84
+ specification_version: 4
99
85
  summary: Simple wrapper around the shapelib library
100
- test_files:
101
- - test/libtest.rb
102
- - test/zsample1.rb
103
- - test/ztest1.rb
86
+ test_files: []
data/test/libtest.rb DELETED
@@ -1,80 +0,0 @@
1
- class AssertFail < Exception
2
- end
3
-
4
- def assert(a, b)
5
- caller = ""
6
- begin
7
- raise "no problem"
8
- rescue RuntimeError => e
9
- caller = e.backtrace[1]
10
- end
11
- if (b === a) then
12
- val = b.inspect
13
- val = "#{val}..." if val.size > 40
14
- print "ok #{caller}: #{val}\n" if $VERBOSE
15
- else
16
- val = a.inspect
17
- val = "#{val}..." if val.size > 200
18
- raise AssertFail, val
19
- end
20
- end
21
-
22
- def file_delete(*args)
23
- for file in args
24
- next unless File.exist?(file)
25
- File.delete(file)
26
- end
27
- end
28
-
29
- def fold_line(line)
30
- buf = ""
31
- while line
32
- head = line[0..63]
33
- buf << (head + "\n")
34
- line = line[64..-1]
35
- end
36
- buf
37
- end
38
-
39
- def assert_file(filename, pat)
40
- f = File.read(filename)
41
- r = [pat.gsub(/\s+/, "")].pack('H*')
42
-
43
- if (r === f) then
44
- print "ok <#{filename}>\n" if $VERBOSE
45
- else
46
- for i in 0...(f.size)
47
- next if (f[i] == r[i])
48
- printf "ofs=%08x file=%02x expected=%02x\n", i, f[i], r[i]
49
- break
50
- end
51
- print "#{filename} is longer than expected\n" if f.size > r.size
52
- h = f.unpack('H*').first
53
- File.open("#{filename}.hex", "w") { |fp| fp.write(fold_line(h)) }
54
- print "hex dump of <#{filename}> is saved to <#{filename}.hex>.\n"
55
- raise AssertFail
56
- end
57
- end
58
-
59
- def testblock(title)
60
- begin
61
- yield
62
- rescue Exception => e
63
- print "#{title} failed: #{e.message} (#{e.class.to_s})\n"
64
- print "| ", e.backtrace[1..-1].join("\n| "), "\n"
65
- return 1
66
- else
67
- print "#{title} ok\n"
68
- return 0
69
- end
70
- end
71
-
72
- def tainttest(msg)
73
- begin
74
- yield
75
- rescue SecurityError => e
76
- assert(e.message, msg)
77
- else
78
- raise SecurityError, "<#{msg}> doesn't come" if $SAFE > 0
79
- end
80
- end
data/test/zsample1.rb DELETED
@@ -1,168 +0,0 @@
1
- require 'shapelib'
2
-
3
- class Sample1
4
- include ShapeLib
5
-
6
- def initialize
7
- end
8
-
9
- def layer1
10
- fp = ShapeFile.new('ts1stn.shp', :Point)
11
- fp.add_field 'name', :String, 24
12
- fp.add_field 'wdir', :String, 6 # 4
13
- fp.add_field 'wspd', :Integer, 6 # 2
14
- fp.add_field 'weather', :String, 16
15
- fp.add_field 'pres', :Integer, 6 # 4
16
- fp.add_field 'temp', :Integer, 6 # 3
17
- fp.write new_point(124.17, 24.33,
18
- 'name' => 'Ishigakijima', 'wdir' => 'S', 'wspd' => 3,
19
- 'weather' => 'shower', 'pres' => 1014, 'temp' => 24)
20
- csv = <<EOF
21
- 127:41.1, 26:12.4, Naha, S, 4, partly cloudy, 1015, 21
22
- 131.23, 25.83, Minamidaito Jima, SSW, 2, partly cloudy, 1017, 20
23
- 129:29.7, 28:22.7, Naze, SW, 2, partly cloudy, 1017, 20
24
- 130.72, 31.80, Kagoshima, WSW, 1, shower, 1013, 18
25
- 128:49.6, 32:41.6, Fukue, NNE, 3, cloudy, 1014, 11
26
- 129:17.5, 34:11.8, Izuhara, NNW, 2, cloudy, 1016, 10
27
- 133:00.6, 32:43.3, Ashizuri Misaki, W, 2, cloudy, 1011, 17
28
- 134:10.6, 33:15.1, Muroto Misaki, NNE, 3, fog, 1012, 13
29
- 132:46.6, 33:50.6, Matsuyama, SE, 1, rain, 1014, 10
30
- 132:04.2, 34:53.8, Hamada, ENE, 1, cloudy, 1015, 8
31
- 133.3, 36.2, Saigo, NNE, 2, shower, 1016, 7
32
- 135.6, 34.7, Osaka, NNE, 2, cloudy, 1014, 9
33
- 135:45.6, 33:27.0, Shio no Misaki, NE, 1, shower, 1012, 13
34
- 139.8, 33.1, Hachijo Jima, SW, 4, shower, 1013, 18
35
- 139.4, 34.8, Izu Oshima, NNE, 4, shower, 1014, 9
36
- 138:12.7, 34:36.2, Omaezaki, NE, 2, rain, 1012, 12
37
- 140:51.4, 35:44.3, Choshi, NNE, 5, rain, 1014, 7
38
- 139:03.6, 36:24.3, Maebashi, WNW, 1, rain, 1015, 8
39
- 140:54.2, 36:56.8, Onahama, N, 3, rain, 1017, 5
40
- 136:53.7, 37:23.5, Wajima, ENE, 1, rain, 1016, 5
41
- 138:14.3, 38:01.7, Aikawa, SE, 2, rain, 1016, 4
42
- 140.9, 38.2, Sendai, NNW, 1, snow-rain, 1018, 1
43
- 141:57.9, 39:38.8, Miyako, N, 2, snow, 1020, 1
44
- 140.2, 39.6, Akita, NNE, 1, cloudy, 1018, 0
45
- 140.8, 41.8, Hakodate, NNE, 3, cloudy, 1019, -4
46
- 142:46.6, 42:09.7, Urakawa, NNE, 2, cloudy, 1019, -5
47
- 145:35.1, 43:19.8, Nemuro, CALM, 0, cloudy, 1019, -5
48
- 141:40.7, 45:24.9, Wakkanai, W, 3, cloudy, 1018, -4
49
- 151, 46, Poronaisk, W, 3, cloudy, 1018, -4
50
- 156, 50, Severo-Kurilsk, WSW, 3, partly cloudy, 1014, -16
51
- 135.17, 48.52, Habarovsk, CALM, 0, partly cloudy, 1014, -19
52
- 135:48, 44:21, Rudnaya Pristan, W, 1, cloudy, 1019, -13
53
- 131.93, 43.12, Vladivostok, SE, 3, cloudy, 1018, -5
54
- 126.97, 37.57, Seoul, NNE, 1, partly cloudy, 1019, 1
55
- 131, 37, Ulleung-do, NE, 1, cloudy, 1018, 3
56
- 128.93, 35.18, Pusan, NNE, 3, cloudy, 1016, 6
57
- 127, 35, Mokpo, NNE, 3, cloudy, 1019, 3
58
- 126.50, 33.50, Cheju-do, NNE, 1, cloudy, 1017, 9
59
- 121.55, 25.07, Taipei, ESE, 1, cloudy, 1013, 21
60
- 120.35, 22.58, Kaohsiung, N, 1, cloudy, 1013, 24
61
- 125.22, 43.90, Changchun, WNW, 3, clear, 1024, -13
62
- 116.28, 39.93, Beijing, NNW, 4, partly cloudy, 1031, -2
63
- 121.63, 38.90, Dalian, NNW, 3, partly cloudy, 1024, -1
64
- 120.33, 36.07, Qingdao, NNW, 4, fog, 1024, 2
65
- 121.4, 31.2, Shanghai, N, 3, rain, 1021, 7
66
- 114.13, 30.62, Wuhan, NNW, 2, rain, 1025, 8
67
- 118.08, 24.48, Xiamen, CALM, 0, fog, 1014, 18
68
- 114.02, 22.20, Hong Kong, ESE, 2, partly cloudy, 1014, 21
69
- 120.53, 18.18, Laoag, CALM, 0, clear, 1012, 22
70
- 121.00, 14.52, Manila, WNW, 1, partly cloudy, 1013, 25
71
- 142.18, 27.08, Chichi Jima, NW, 1, clear, 1020, 16
72
- 133.97, 24.30, Minami Tori Shima, E, 4, X, 1021, 23
73
- 138:43.6, 35:21.6, Fujisan, X, X, X, X, -4
74
- 126, 29, SHIP, NW, 5, rain, 1015, X
75
- 148, 21, SHIP, E, 3, cloudy, 1018, X
76
- 139, 31, SHIP, SW, 7, partly cloudy, 1016, X
77
- 136, 39, SHIP, ENE, 5, partly cloudy, 1017, X
78
- 146, 36, SHIP, ENE, 5, rain, 1013, X
79
- EOF
80
- for line in csv.split(/\n/)
81
- x, y, name, wdir, wspd, weather, pres, temp = line.split(/, */)
82
- x = $1.to_i + $2.to_f / 60 if /(\d+):(\d+(\.\d)?)/ === x
83
- y = $1.to_i + $2.to_f / 60 if /(\d+):(\d+(\.\d)?)/ === y
84
- x = Float(x)
85
- y = Float(y)
86
- wdir = nil if wdir == 'X'
87
- weather = nil if weather == 'X'
88
- wspd = (wspd == 'X' ? nil : Integer(wspd))
89
- pres = (pres == 'X' ? nil : Integer(pres))
90
- temp = (temp == 'X' ? nil : Integer(temp))
91
- fp.write new_point(x, y,
92
- 'name' => name, 'wdir' => wdir, 'wspd' => wspd,
93
- 'weather' => weather , 'pres' => pres, 'temp' => temp)
94
- end
95
- fp.close
96
- end
97
-
98
- def layer2
99
- fp = ShapeFile.new('ts1sys.shp', :Point)
100
- fp.add_field 'class', 'String', 16
101
- fp.add_field 'symbol', 'String', 3
102
- fp.add_field 'pres', 'Integer', 4
103
- fp.add_field 'dir', 'String', 4
104
- fp.add_field 'speed', 'Integer', 3
105
- fp.write new_point(169, 45, 'class' => 'Low', 'symbol' => 'L',
106
- 'pres' => 992, 'dir' => 'NNE', 'speed' => 20)
107
- fp.write new_point(177, 58, 'class' => 'Low', 'symbol' => 'L',
108
- 'pres' => 996, 'dir' => 'N', 'speed' => 10)
109
- fp.write new_point(130, 41, 'class' => 'Low', 'symbol' => 'L',
110
- 'pres' => 1016, 'dir' => 'ENE', 'speed' => 10)
111
- fp.write new_point(134, 33, 'class' => 'Low', 'symbol' => 'L',
112
- 'pres' => 1012, 'dir' => 'ENE', 'speed' => 20)
113
- fp.write new_point(152, 57, 'class' => 'Low', 'symbol' => 'L',
114
- 'pres' => 1000, 'dir' => 'WSW', 'speed' => 5)
115
- fp.write new_point(156, 48, 'class' => 'Low', 'symbol' => 'L',
116
- 'pres' => 1004, 'dir' => 'E', 'speed' => 10)
117
- fp.write new_point(139, 3, 'class' => 'Low', 'symbol' => 'L',
118
- 'pres' => 1008, 'dir' => 'STNR', 'speed' => 0)
119
- fp.write new_point(138, 43, 'class' => 'High', 'symbol' => 'H',
120
- 'pres' => 1020, 'dir' => 'E', 'speed' => 15)
121
- fp.write new_point(164, 29, 'class' => 'High', 'symbol' => 'H',
122
- 'pres' => 1024, 'dir' => 'E', 'speed' => 20)
123
- fp.close
124
- end
125
-
126
- def layer3
127
- fp = ShapeFile.new('ts1frnt.shp', :Arc)
128
- fp.add_field 'class', 'String', 16
129
-
130
- arc = Arc.new [[169, 45], [172, 44], [175, 41]]
131
- arc['class'] = 'occlusion'
132
- fp.write arc
133
-
134
- arc = Arc.new [[175, 41], [177, 39], [178, 37]]
135
- arc['class'] = 'warm'
136
- fp.write arc
137
-
138
- arc = Arc.new [[175, 41], [171, 38], [164, 36]]
139
- arc['class'] = 'cold'
140
- fp.write arc
141
-
142
- arc = Arc.new [[119, 27], [128, 29], [134, 33], [139, 34],
143
- [142, 35], [150, 35]]
144
- arc['class'] = 'stationary'
145
- fp.write arc
146
-
147
- fp.close
148
- end
149
-
150
- def layer4
151
- fp = ShapeFile.new('ts1isop.shp', :Arc)
152
- fp.add_field 'pres', 'Integer', 4
153
- arc = Arc.new [[168, 19], [150, 18], [141, 19], [129, 22], [133, 29], [147, 34], [149, 36], [141, 37], [128, 34], [122, 28], [110, 25]]
154
- arc['pres'] = 1016
155
- fp.write arc
156
- fp.close
157
- end
158
-
159
- def run
160
- layer1
161
- layer2
162
- layer3
163
- layer4
164
- end
165
-
166
- end
167
-
168
- Sample1.new.run