geonames_local 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/geonames_local.gemspec +2 -3
- data/lib/data/shp.rb +3 -3
- data/lib/features/road.rb +5 -2
- metadata +2 -3
- data/geonames.yml +0 -14
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
data/geonames_local.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{geonames_local}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Marcos Piccinini"]
|
12
|
-
s.date = %q{2010-01-
|
12
|
+
s.date = %q{2010-01-30}
|
13
13
|
s.default_executable = %q{geonames}
|
14
14
|
s.description = %q{Dump and feed a tokyo cabinet for local geonames search}
|
15
15
|
s.email = %q{x@nofxx.com}
|
@@ -26,7 +26,6 @@ Gem::Specification.new do |s|
|
|
26
26
|
"Rakefile",
|
27
27
|
"VERSION",
|
28
28
|
"bin/geonames",
|
29
|
-
"geonames.yml",
|
30
29
|
"geonames_local.gemspec",
|
31
30
|
"lib/config/codes.yml",
|
32
31
|
"lib/config/geonames.yml",
|
data/lib/data/shp.rb
CHANGED
@@ -11,9 +11,9 @@ module Geonames
|
|
11
11
|
@type = Object.module_eval("::#{Opt[:type].capitalize}", __FILE__, __LINE__)
|
12
12
|
@ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
|
13
13
|
@sample = nil
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
if file
|
15
|
+
shp2pg; parse; write
|
16
|
+
end
|
17
17
|
end
|
18
18
|
|
19
19
|
def shp2pg
|
data/lib/features/road.rb
CHANGED
@@ -13,15 +13,18 @@ class Road
|
|
13
13
|
@name = r[:name]
|
14
14
|
@zone = r[:zone]
|
15
15
|
kind = r[:kind] || @name.split(" ")[0]
|
16
|
+
@geom = parse_geom(r[:geom])
|
16
17
|
@kind = parse_kind(kind)
|
17
18
|
@city = city
|
18
19
|
@country = country
|
19
|
-
parse_geom(r[:geom])
|
20
20
|
@table = :roads
|
21
21
|
end
|
22
22
|
|
23
23
|
def parse_geom(hex)
|
24
|
-
|
24
|
+
if hex =~ /^SRID/ # PG 8.3 support
|
25
|
+
hex = hex.split(";")[1]
|
26
|
+
end
|
27
|
+
GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(hex)
|
25
28
|
end
|
26
29
|
|
27
30
|
def geom=(g)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geonames_local
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcos Piccinini
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-30 00:00:00 -02:00
|
13
13
|
default_executable: geonames
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- Rakefile
|
50
50
|
- VERSION
|
51
51
|
- bin/geonames
|
52
|
-
- geonames.yml
|
53
52
|
- geonames_local.gemspec
|
54
53
|
- lib/config/codes.yml
|
55
54
|
- lib/config/geonames.yml
|