shp2geocouch 0.0.6 → 0.0.7

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
data/bin/shp2geocouch CHANGED
@@ -19,7 +19,6 @@ class ShapefileToGeoCouch
19
19
  upload
20
20
  add_ddoc
21
21
  cleanup if @cleanup
22
- puts "Upload complete. Test your data at #{@database_url}/_design/geo/_spatial/full?bbox=-180,180,-90,90" if @verbose
23
22
  end
24
23
 
25
24
  def set_accessors(options)
@@ -85,7 +84,7 @@ class ShapefileToGeoCouch
85
84
  end
86
85
 
87
86
  def upload
88
- puts "Bulk loading data into GeoCouch... view progress at #{@database_url}/_utils" if @verbose
87
+ puts "Bulk loading data into GeoCouch... view progress at #{couch_url}/_utils" if @verbose
89
88
  group = []
90
89
  length = File.open(bulk).lines.count - 1
91
90
  File.open(bulk).each_with_index do |line, index|
@@ -101,27 +100,35 @@ class ShapefileToGeoCouch
101
100
  end
102
101
  group << line
103
102
  end
103
+ puts "Shapefile upload complete. View data at #{couch_url}/_utils/database.html?#{@name}"
104
+ end
105
+
106
+ def view_exists?
107
+ @db.get('_design/geo') rescue false
104
108
  end
105
109
 
106
110
  # replicates geocouch-utils into the db via http://max.iriscouch.com/apps/_design/geo
107
111
  def add_ddoc
108
- puts "Replicating http://github.com/maxogden/geocouch-utils..." if @verbose
109
- view_exists = @db.get('_design/geo') rescue false
110
112
  internet_connection = HTTParty.get(@geocouch_utils) rescue false
111
- if !view_exists && internet_connection
112
- resp = HTTParty.post(couch_url + '/_replicate',
113
- :body => '{"source":' + @geocouch_utils + ',"target":"' + @name + '", "doc_ids":["_design/geo"]}',
114
- :headers => {'content-type' => "application/json"}
115
- )
116
- resp = JSON.parse(resp)
117
- if ((resp.keys.include? 'ok') && (resp['ok'] == true))
118
- puts "View your data at #{@database_url}/_design/geo/_rewrite"
113
+ if internet_connection
114
+ if !view_exists?
115
+ puts "Replicating geocouch-utils + map browser from #{@geocouch_utils}..."
116
+ HTTParty.post(couch_url + '/_replicate',
117
+ :body => '{"source":"' + @geocouch_utils + '","target":"' + @name + '", "doc_ids":["_design/geo"]}',
118
+ :headers => {'content-type' => "application/json"}
119
+ ) rescue timeout = true
120
+ if timeout
121
+ puts "Replication is taking a while. Check the status at #{couch_url}/_utils/status.html"
122
+ puts "Once it is done you can view a map of your data at #{@database_url}/_design/geo/_rewrite"
123
+ else
124
+ puts "View your data on a map at #{@database_url}/_design/geo/_rewrite"
125
+ end
119
126
  else
120
- puts "View your data at http://#{couch_url}/_utils"
127
+ puts "geocouch-utils seems to already be installed in this database"
128
+ puts "There might be a map at #{@database_url}/_design/geo/_rewrite"
121
129
  end
122
- elsif @verbose
123
- puts "Did not push geocouch-utils -- either it already exists or internet is off"
124
- puts "You can get geocouch-utils from http://github.com/maxogden/geocouch-utils"
130
+ else
131
+ puts "To view this data on a map see http://github.com/maxogden/geocouch-utils"
125
132
  end
126
133
  end
127
134
 
Binary file
data/shp2geocouch.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{shp2geocouch}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Max Ogden"]
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "bin/shp2geocouch",
27
- "pkg/shp2geocouch-0.0.6.gem",
27
+ "pkg/shp2geocouch-0.0.7.gem",
28
28
  "shp2geocouch.gemspec"
29
29
  ]
30
30
  s.homepage = %q{http://github.com/maxogden/shp2geocouch}
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shp2geocouch
3
3
  version: !ruby/object:Gem::Version
4
- hash: 19
4
+ hash: 17
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 6
10
- version: 0.0.6
9
+ - 7
10
+ version: 0.0.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Max Ogden
@@ -61,7 +61,7 @@ files:
61
61
  - Rakefile
62
62
  - VERSION
63
63
  - bin/shp2geocouch
64
- - pkg/shp2geocouch-0.0.6.gem
64
+ - pkg/shp2geocouch-0.0.7.gem
65
65
  - shp2geocouch.gemspec
66
66
  has_rdoc: true
67
67
  homepage: http://github.com/maxogden/shp2geocouch
Binary file