osmn 0.1.0 → 0.1.1

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/README.md CHANGED
@@ -0,0 +1,75 @@
1
+ # OSMN
2
+ A Ruby wrapper for the OpenStreetMap Nominatim API.
3
+
4
+ > Nominatim is a tool to search osm data by name and address
5
+ and to generate synthetic addresses of osm points (reverse geocoding).
6
+
7
+ Service can be found at http://nominatim.openstreetmap.org
8
+ API Details can be found at http://wiki.openstreetmap.org/wiki/Nominatim
9
+
10
+ ## Installation
11
+
12
+ $ gem install osmn
13
+
14
+ ## Usage
15
+ The easy way:
16
+ ```ruby
17
+ # search for a place
18
+ OSMN::search('135 pilkington avenue, birmingham')
19
+
20
+ # convert latitude and longitude into a place
21
+ OSMN::reverse_geocode(52.5487429714954, -1.81602098644987)
22
+ ```
23
+ The full control way:
24
+ ```ruby
25
+ # search for address
26
+ search = OSMN::Search.new(:addressdetails => 1)
27
+ search.params = {:limit => 1}
28
+
29
+ # you can revise the params used
30
+ search.params
31
+ # >> {:addressdetails => 1, :limit => 1}
32
+
33
+ # and if all is ok, you can execute the query
34
+ search.search
35
+ ```
36
+
37
+ ```ruby
38
+ # convert lat and long
39
+ search = OSMN::Reverse.new(:lat => 52.5487429714954)
40
+ search.params = {:lon => -1.81602098644987}
41
+
42
+ # check the params
43
+ search.params
44
+ # >> {:lat => 52.5487429714954, :lon => -1.81602098644987}
45
+
46
+ # run the query
47
+ search.reverse_geocode
48
+ ```
49
+
50
+ Check the available parameters for each query on the Nominatim Wiki page (http://wiki.openstreetmap.org/wiki/Nominatim)
51
+
52
+ ## License
53
+ Copyright (c) 2012, Jorge Kalmbach <kalmbach.at.gmail.com>
54
+
55
+ Permission is hereby granted, free of charge, to any
56
+ person obtaining a copy of this software and associated
57
+ documentation files (the "Software"), to deal in the
58
+ Software without restriction, including without limitation
59
+ the rights to use, copy, modify, merge, publish,
60
+ distribute, sublicense, and/or sell copies of the
61
+ Software, and to permit persons to whom the Software is
62
+ furnished to do so, subject to the following conditions:
63
+
64
+ The above copyright notice and this permission notice
65
+ shall be included in all copies or substantial portions of
66
+ the Software.
67
+
68
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
69
+ KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
70
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
71
+ PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
72
+ OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
73
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
74
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
75
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/lib/osmn/reverse.rb CHANGED
@@ -21,7 +21,7 @@ module OSMN
21
21
  def params=(value)
22
22
  if value.is_a? Hash
23
23
  value.each do |k,v|
24
- @params[k.to_sym] = v unless v.nil?
24
+ @params[k.to_sym] = v
25
25
  end
26
26
  end
27
27
 
data/lib/osmn/search.rb CHANGED
@@ -21,7 +21,7 @@ module OSMN
21
21
  def params=(value)
22
22
  if value.is_a? Hash
23
23
  value.each do |k,v|
24
- @params[k.to_sym] = v unless v.nil?
24
+ @params[k.to_sym] = v
25
25
  end
26
26
  end
27
27
 
data/lib/osmn/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module OSMN
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: osmn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: