osmn 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +75 -0
- data/lib/osmn/reverse.rb +1 -1
- data/lib/osmn/search.rb +1 -1
- data/lib/osmn/version.rb +1 -1
- metadata +1 -1
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
data/lib/osmn/search.rb
CHANGED
data/lib/osmn/version.rb
CHANGED