shp2geocouch 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. data/README.textile +5 -1
  2. data/Rakefile +2 -0
  3. data/VERSION +1 -1
  4. data/bin/shp2geocouch +4 -1
  5. metadata +33 -6
data/README.textile CHANGED
@@ -4,7 +4,7 @@ This is an executable rubygem that creates "GeoCouch":http://www.github.com/vmx/
4
4
 
5
5
  h2. Installation
6
6
 
7
- You will need access to a GeoCouch server. For instructions on setting up your own local GeoCouch, check out "my related blog post":http://maxogden.com.
7
+ You will need access to a GeoCouch server. For instructions on setting up your own local GeoCouch, check out "my related blog post":http://maxogden.com/#/2010-08-14-loading-shapefiles-into-geocouch.html.
8
8
 
9
9
  Install dependencies:
10
10
  @unzip@, @sed@, @ogr2ogr@
@@ -13,6 +13,10 @@ If you are on Mac OS X, you will already have @unzip@ and @sed@ installed. To ge
13
13
 
14
14
  Note: @ogr2ogr@ is usually included with the @gdal@ package (sometimes called @gdal-bin@).
15
15
 
16
+ @shp2geocouch@ depends on the following gems:
17
+ * @httparty@ for sending data to CouchDB
18
+ * @couchrest@ for interacting with CouchDB
19
+
16
20
  Install the @shp2geocouch@ gem:
17
21
 
18
22
  @gem install shp2geocouch@
data/Rakefile CHANGED
@@ -10,6 +10,8 @@ begin
10
10
  gem.email = "max@maxogden.com"
11
11
  gem.homepage = "http://github.com/maxogden/shp2geocouch"
12
12
  gem.authors = ["Max Ogden"]
13
+ gem.add_dependency 'httparty'
14
+ gem.add_dependency 'couchrest'
13
15
  end
14
16
  Jeweler::GemcutterTasks.new
15
17
  rescue LoadError
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
data/bin/shp2geocouch CHANGED
@@ -2,6 +2,7 @@
2
2
  require 'httparty'
3
3
  require 'couchrest'
4
4
  require 'optparse'
5
+ require 'iconv'
5
6
 
6
7
  class ShapefileToGeoCouch
7
8
  attr_accessor :path, :extension, :name, :couch_url, :cleanup, :verbose
@@ -74,9 +75,11 @@ class ShapefileToGeoCouch
74
75
  end
75
76
 
76
77
  def upload
78
+ ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') # disregard all UTF8 characters
77
79
  puts "Bulk loading data into GeoCouch... view progress at #{@couch_url}/_utils" if @verbose
78
80
  File.open(bulk).each_line do |line|
79
- HTTParty.post(database_url + '/_bulk_docs', :body => '{"docs": [' + line[0..-3] + "]}", :headers => {'content-type' => "application/json"})
81
+ valid_string = ic.iconv(line[0..-3] + ' ')[0..-3] # http://po-ru.com/diary/fixing-invalid-utf-8-in-ruby-revisited/
82
+ HTTParty.post(database_url + '/_bulk_docs', :body => '{"docs": [' + valid_string + "]}", :headers => {'content-type' => "application/json"})
80
83
  end
81
84
  end
82
85
 
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: 29
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 2
10
+ version: 0.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Max Ogden
@@ -15,10 +15,37 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-09-05 00:00:00 -07:00
18
+ date: 2010-09-23 00:00:00 -07:00
19
19
  default_executable: shp2geocouch
20
- dependencies: []
21
-
20
+ dependencies:
21
+ - !ruby/object:Gem::Dependency
22
+ name: httparty
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ hash: 3
30
+ segments:
31
+ - 0
32
+ version: "0"
33
+ type: :runtime
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: couchrest
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ hash: 3
44
+ segments:
45
+ - 0
46
+ version: "0"
47
+ type: :runtime
48
+ version_requirements: *id002
22
49
  description: rubygem that converts Shapefiles into GeoCouch databases
23
50
  email: max@maxogden.com
24
51
  executables: