elecnix-ruby-geonames 0.2.2 → 0.2.3

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.
Files changed (3) hide show
  1. data/README.markdown +72 -0
  2. metadata +3 -3
  3. data/README +0 -15
data/README.markdown ADDED
@@ -0,0 +1,72 @@
1
+ # Geonames Ruby API
2
+
3
+ Ruby library for [Geonames Web Services](http://www.geonames.org/export/)
4
+
5
+ Created by [TouchBase Counsulting](http://www.tbcn.ca/geonames) to support GIS processes for [Carpool Connect](http://www.carpoolconnect.com/). Inspired by the Geonames [Java Client API library](http://www.geonames.org/source-code/).
6
+
7
+ ## Installing ruby-geonames
8
+
9
+ Install from the command line:
10
+
11
+ sudo gem install elecnix-ruby-geonames
12
+
13
+ ## Examples
14
+
15
+ The following exercises several of the Geonames web services, [full list of services](http://www.geonames.org/export/).
16
+
17
+ **Load the the geonames API**
18
+
19
+ require 'geonames'
20
+
21
+ **get list of places near by longitude/longitude location**
22
+
23
+ places_nearby = Geonames::WebService.find_nearby_place_name 43.900120387, -78.882869834
24
+ p places_nearby
25
+
26
+ outputs:
27
+
28
+ `[#<Geonames::Toponym:0x6c8c98 @population=nil, @geoname_id='6094578', @longitude=-78.849568878, @feature_class_name=nil, @country_name='Canada', @latitude=43.900120387, @feature_class='P', @country_code='CA', @name='Oshawa', @feature_code_name=nil, @elevation=nil, @distance=2.6679930307932, @alternate_names=nil, @feature_code='PPL'>]`
29
+
30
+ **get timezone for longitude/longitude location**
31
+
32
+ timezone = Geonames::WebService.timezone 43.900120387, -78.882869834
33
+ p timezone
34
+
35
+ **get country code for longitude/longitude location**
36
+
37
+ country_code = Geonames::WebService.country_code 43.900120387, -78.882869834
38
+ p country_code
39
+
40
+ **get country sub-division info for longitude/longitude location**
41
+
42
+ country_subdivision = Geonames::WebService.country_subdivision 43.900120387, -78.882869834
43
+ p country_subdivision
44
+
45
+ **get postal codes for a given location**
46
+
47
+ postal_code_sc = Geonames::PostalCodeSearchCriteria.new
48
+ postal_code_sc.place_name = "Oshawa"
49
+ postal_codes = Geonames::WebService.postal_code_search postal_code_sc
50
+ p postal_codes
51
+
52
+ **get nearby postal codes for a place name**
53
+
54
+ postal_code_sc = Geonames::PostalCodeSearchCriteria.new
55
+ postal_code_sc.place_name = "Oshawa"
56
+ postal_codes_nearby = Geonames::WebService.find_nearby_postal_codes postal_code_sc
57
+ p postal_codes_nearby
58
+
59
+ ## Commercial Service Support
60
+
61
+ If you use the commercial service, you should put something like this in your configuration:
62
+
63
+ Geonames::username = 'username'
64
+ Geonames::base_url = 'http://ws.geonames.net'
65
+
66
+ In a Rails application, this would go in the `config/environment.rb` file.
67
+
68
+ # Contributors
69
+
70
+ 1. Adam Wisniewski
71
+ 2. Nicolas Marchildon (elecnix)
72
+
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elecnix-ruby-geonames
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Wisniewski
@@ -20,9 +20,9 @@ executables: []
20
20
  extensions: []
21
21
 
22
22
  extra_rdoc_files:
23
- - README
23
+ - README.markdown
24
24
  files:
25
- - README
25
+ - README.markdown
26
26
  has_rdoc: true
27
27
  homepage: http://www.tbcn.ca/ruby_geonames
28
28
  post_install_message:
data/README DELETED
@@ -1,15 +0,0 @@
1
- h2. Geonames Ruby API
2
-
3
- Ruby library for Geonames Web Services (http://www.geonames.org/export/)
4
-
5
- Inspired by the Geonames Java Client API library
6
-
7
- http://www.tbcn.ca/geonames
8
-
9
- If you use the commercial service, you should put something like this in your configuration:
10
-
11
- <pre>Geonames::username = 'username'
12
- Geonames::base_url = 'http://ws.geonames.net'
13
- </pre>
14
-
15
- In a Rails application, this would go in the @config/environment.rb@ file.