cartodb-importer 0.2.16 → 0.2.17

Sign up to get free protection for your applications and to get access to all the features.
@@ -276,8 +276,19 @@ module CartoDB
276
276
  if matching_latitude and matching_longitude
277
277
  #we know there is a latitude/longitude columns
278
278
  @db_connection.run("SELECT AddGeometryColumn('#{@suggested_name}','the_geom',4326, 'POINT', 2);")
279
- @db_connection.run("UPDATE \"#{@suggested_name}\" SET the_geom = ST_GeomFromText('POINT('|| \"#{matching_longitude}\" ||' '|| \"#{matching_latitude}\" ||')',4326)
280
- WHERE \"#{matching_longitude}\" IS NOT NULL AND \"#{matching_latitude}\" IS NOT NULL AND \"#{matching_longitude}\"<>'' AND \"#{matching_latitude}\"<>''")
279
+
280
+ @db_connection.run(<<-GEOREF
281
+ UPDATE \"#{@suggested_name}\"
282
+ SET the_geom =
283
+ ST_GeomFromText(
284
+ 'POINT(' || \"#{matching_longitude}\" || ' ' || \"#{matching_latitude}\" || ')', 4326
285
+ )
286
+ WHERE
287
+ CAST(\"#{matching_longitude}\" AS text) ~ '^(([-+]?(([0-9]|[1-9][0-9]|1[0-7][0-9])(\.[0-9]+)?))|[-+]?180)$'
288
+ AND
289
+ CAST(\"#{matching_latitude}\" AS text) ~ '^(([-+]?(([0-9]|[1-8][0-9])(\.[0-9]+)?))|[-+]?90)$'
290
+ GEOREF
291
+ )
281
292
  @db_connection.run("CREATE INDEX \"#{@suggested_name}_the_geom_gist\" ON \"#{@suggested_name}\" USING GIST (the_geom)")
282
293
  end
283
294
  end
@@ -1,6 +1,6 @@
1
1
  module CartoDB
2
2
  class Importer
3
- VERSION = "0.2.16"
3
+ VERSION = "0.2.17"
4
4
  end
5
5
  end
6
6
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartodb-importer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.16
4
+ version: 0.2.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -12,11 +12,11 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2011-10-04 00:00:00.000000000Z
15
+ date: 2011-10-06 00:00:00.000000000Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: pg
19
- requirement: &70113643297840 !ruby/object:Gem::Requirement
19
+ requirement: &70363733332580 !ruby/object:Gem::Requirement
20
20
  none: false
21
21
  requirements:
22
22
  - - ~>
@@ -24,10 +24,10 @@ dependencies:
24
24
  version: '0.11'
25
25
  type: :runtime
26
26
  prerelease: false
27
- version_requirements: *70113643297840
27
+ version_requirements: *70363733332580
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: sequel
30
- requirement: &70113643296820 !ruby/object:Gem::Requirement
30
+ requirement: &70363733331740 !ruby/object:Gem::Requirement
31
31
  none: false
32
32
  requirements:
33
33
  - - ~>
@@ -35,10 +35,10 @@ dependencies:
35
35
  version: 3.28.0
36
36
  type: :runtime
37
37
  prerelease: false
38
- version_requirements: *70113643296820
38
+ version_requirements: *70363733331740
39
39
  - !ruby/object:Gem::Dependency
40
40
  name: roo
41
- requirement: &70113643295980 !ruby/object:Gem::Requirement
41
+ requirement: &70363733331020 !ruby/object:Gem::Requirement
42
42
  none: false
43
43
  requirements:
44
44
  - - ~>
@@ -46,10 +46,10 @@ dependencies:
46
46
  version: 1.9.7
47
47
  type: :runtime
48
48
  prerelease: false
49
- version_requirements: *70113643295980
49
+ version_requirements: *70363733331020
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: spreadsheet
52
- requirement: &70113643292540 !ruby/object:Gem::Requirement
52
+ requirement: &70363733330320 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ~>
@@ -57,10 +57,10 @@ dependencies:
57
57
  version: 0.6.5.9
58
58
  type: :runtime
59
59
  prerelease: false
60
- version_requirements: *70113643292540
60
+ version_requirements: *70363733330320
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: google-spreadsheet-ruby
63
- requirement: &70113643291600 !ruby/object:Gem::Requirement
63
+ requirement: &70363733329560 !ruby/object:Gem::Requirement
64
64
  none: false
65
65
  requirements:
66
66
  - - ~>
@@ -68,10 +68,10 @@ dependencies:
68
68
  version: 0.1.5
69
69
  type: :runtime
70
70
  prerelease: false
71
- version_requirements: *70113643291600
71
+ version_requirements: *70363733329560
72
72
  - !ruby/object:Gem::Dependency
73
73
  name: rubyzip
74
- requirement: &70113643290720 !ruby/object:Gem::Requirement
74
+ requirement: &70363733328960 !ruby/object:Gem::Requirement
75
75
  none: false
76
76
  requirements:
77
77
  - - ~>
@@ -79,10 +79,10 @@ dependencies:
79
79
  version: 0.9.4
80
80
  type: :runtime
81
81
  prerelease: false
82
- version_requirements: *70113643290720
82
+ version_requirements: *70363733328960
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: builder
85
- requirement: &70113643289920 !ruby/object:Gem::Requirement
85
+ requirement: &70363733328360 !ruby/object:Gem::Requirement
86
86
  none: false
87
87
  requirements:
88
88
  - - ! '>='
@@ -90,10 +90,10 @@ dependencies:
90
90
  version: '0'
91
91
  type: :runtime
92
92
  prerelease: false
93
- version_requirements: *70113643289920
93
+ version_requirements: *70363733328360
94
94
  - !ruby/object:Gem::Dependency
95
95
  name: rgeo
96
- requirement: &70113643288440 !ruby/object:Gem::Requirement
96
+ requirement: &70363733327540 !ruby/object:Gem::Requirement
97
97
  none: false
98
98
  requirements:
99
99
  - - ~>
@@ -101,10 +101,10 @@ dependencies:
101
101
  version: 0.3.2
102
102
  type: :runtime
103
103
  prerelease: false
104
- version_requirements: *70113643288440
104
+ version_requirements: *70363733327540
105
105
  - !ruby/object:Gem::Dependency
106
106
  name: rgeo-geojson
107
- requirement: &70113643287060 !ruby/object:Gem::Requirement
107
+ requirement: &70363733326760 !ruby/object:Gem::Requirement
108
108
  none: false
109
109
  requirements:
110
110
  - - ~>
@@ -112,10 +112,10 @@ dependencies:
112
112
  version: 0.2.1
113
113
  type: :runtime
114
114
  prerelease: false
115
- version_requirements: *70113643287060
115
+ version_requirements: *70363733326760
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: rspec
118
- requirement: &70113643285860 !ruby/object:Gem::Requirement
118
+ requirement: &70363733326080 !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements:
121
121
  - - ~>
@@ -123,10 +123,10 @@ dependencies:
123
123
  version: 2.6.0
124
124
  type: :development
125
125
  prerelease: false
126
- version_requirements: *70113643285860
126
+ version_requirements: *70363733326080
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: mocha
129
- requirement: &70113643273800 !ruby/object:Gem::Requirement
129
+ requirement: &70363733325400 !ruby/object:Gem::Requirement
130
130
  none: false
131
131
  requirements:
132
132
  - - ~>
@@ -134,10 +134,10 @@ dependencies:
134
134
  version: 0.10.0
135
135
  type: :development
136
136
  prerelease: false
137
- version_requirements: *70113643273800
137
+ version_requirements: *70363733325400
138
138
  - !ruby/object:Gem::Dependency
139
139
  name: ruby-debug19
140
- requirement: &70113643272620 !ruby/object:Gem::Requirement
140
+ requirement: &70363733324700 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
143
  - - ~>
@@ -145,7 +145,7 @@ dependencies:
145
145
  version: 0.11.6
146
146
  type: :development
147
147
  prerelease: false
148
- version_requirements: *70113643272620
148
+ version_requirements: *70363733324700
149
149
  description: Import CSV, SHP, and other files with data into a PostgreSQL table
150
150
  email:
151
151
  - andrew@vizzuality.com