volt-osmaps 0.1.0 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +23 -3
- data/app/osmaps/controllers/main_controller.rb +6 -2
- data/app/osmaps/controllers/marker_controller.rb +12 -0
- data/app/osmaps/controllers/polygon_controller.rb +12 -0
- data/app/osmaps/example.jpg +0 -0
- data/app/osmaps/views/main/index.html +1 -1
- data/app/osmaps/views/marker/index.html +3 -0
- data/app/osmaps/views/polygon/index.html +3 -0
- data/lib/volt/osmaps/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5172d71483306b4b43330eae6db44286c051221a
|
4
|
+
data.tar.gz: 303016bdb6da60edd5be61f484a6924f8979d3da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78a4e37ab30534bbc3b74e84a7e8bb8931cea53778875b2ac1948dbad38363941e6b64a8a206c96b65fe937b427f2649a4a9a59026d5cf3569eb6a92e3a7ddd1
|
7
|
+
data.tar.gz: cd58a559f1ba0f2b6fac19adead8667253a607a9ea79eb1d0f69ddb51c3512bb3939e9847d820428c3edfc6fcb11a7c2f14d328db6a124e2b20beb17f2ce3669
|
data/README.md
CHANGED
@@ -18,13 +18,33 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
+
### Map
|
22
|
+
|
21
23
|
Typical Usage to add a map with a marker:
|
22
24
|
|
23
|
-
<:osmaps height="380px" latitude="{{ latitude }}" longitude="{{ longitude }}"
|
25
|
+
<:osmaps height="380px" latitude="{{ latitude }}" longitude="{{ longitude }}" />
|
26
|
+
|
27
|
+
Options
|
28
|
+
* title to show a marker at the center of the map. On click, a popup will show title
|
29
|
+
* zoom is a numeric option. Default is 15
|
30
|
+
|
31
|
+
With the option title given, it will show a map as such:
|
32
|
+
|
33
|
+
![Example map](https://github.com/heri/volt-osmaps/blob/master/app/osmaps/example.jpg?raw=true)
|
34
|
+
|
35
|
+
You will need a geocoder if you only have a street address instead of the latitude, longitude coordinates.
|
36
|
+
|
37
|
+
### Adding a marker
|
38
|
+
|
39
|
+
After you have set a <:osmaps />, you can add markers and polygons:
|
40
|
+
|
41
|
+
<:osmaps:marker latitude="{{ latitude }}" longitude="{{ longitude }}" title="{{ title }}"/>
|
42
|
+
|
43
|
+
### Polygon
|
24
44
|
|
25
|
-
|
45
|
+
An array of lat,long coordinates will draw a polygon layer on the map. For example:
|
26
46
|
|
27
|
-
|
47
|
+
<:osmaps:polygon LatLongArray="[[51.509, -0.08],[51.503, -0.06],[51.51, -0.047]]" />
|
28
48
|
|
29
49
|
## Contributing
|
30
50
|
|
@@ -3,10 +3,14 @@ module Osmaps
|
|
3
3
|
def index
|
4
4
|
end
|
5
5
|
|
6
|
-
def map(latitude, longitude,
|
6
|
+
def map(latitude, longitude, opts = {})
|
7
7
|
`var osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',osmAttrib = '© <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib});`
|
8
|
+
zoom = opts[:zoom] || 15
|
8
9
|
`var map = L.map('osmaps').setView([latitude, longitude], 15).addLayer(osm);`
|
9
|
-
|
10
|
+
if opts[:title]
|
11
|
+
`L.marker([ latitude, longitude]).addTo(map).bindPopup(title);`
|
12
|
+
end
|
13
|
+
`L.control.scale( {imperial: false} )`
|
10
14
|
return nil
|
11
15
|
end
|
12
16
|
|
Binary file
|
data/lib/volt/osmaps/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: volt-osmaps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- heri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: volt
|
@@ -218,7 +218,12 @@ files:
|
|
218
218
|
- app/osmaps/config/initializers/boot.rb
|
219
219
|
- app/osmaps/config/routes.rb
|
220
220
|
- app/osmaps/controllers/main_controller.rb
|
221
|
+
- app/osmaps/controllers/marker_controller.rb
|
222
|
+
- app/osmaps/controllers/polygon_controller.rb
|
223
|
+
- app/osmaps/example.jpg
|
221
224
|
- app/osmaps/views/main/index.html
|
225
|
+
- app/osmaps/views/marker/index.html
|
226
|
+
- app/osmaps/views/polygon/index.html
|
222
227
|
- lib/volt/osmaps.rb
|
223
228
|
- lib/volt/osmaps/version.rb
|
224
229
|
- spec/dummy/.gitignore
|