mapkick-static 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a8fd5cb74990e96209e87feab8beee6b31e1d69a42f34a10a92beb03cd5e064
4
- data.tar.gz: d18aa7816d2e76a2cead6a487d443b88c3876d28f3885b578318e03d9c87332b
3
+ metadata.gz: d904b2e2d864f7d3bb3fdf9165b706b1b3c1f4b0448e83a68f1484cf38a88fd1
4
+ data.tar.gz: b51bffe8883486fc20814c15e7393c60052c18db2521332baea82d769e5cd5e3
5
5
  SHA512:
6
- metadata.gz: 35dd8ef3064bc945f515119fee0fa29e0f58aad2e2042a5a23e407b6fa5cc10bdc6b5c109c61196c59fd7c71cb95f5e37aabc3bfc7e49101fccdb52bddfaac8e
7
- data.tar.gz: e0e8577a9d1e7dd8cc6dc5b55e125f84aa03d5f0a61cda7068608cc807b12bfc7e2729d09d947e211558171d8c54a3567f0afeb1fac9fcd20441706c87064989
6
+ metadata.gz: 11b7539144765466bd0fd84fe25e346f73cab2bcaf7f64b02696b7c9e297e3d17c5b9174202aea3b51c0737a59bfbd9049a5384cb38f03ca3e414f56d787c826
7
+ data.tar.gz: 46766cba3d76a8a64c1d291b6d57222a770e6ef8969f2610e595412ac7763d5291f3858a8e6c9247c90b2424c9305b0a0ff35ae382f18a0ef4c86a9cd4073157
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.1 (2023-05-03)
2
+
3
+ - Fixed error with empty maps
4
+
1
5
  ## 0.1.0 (2023-04-26)
2
6
 
3
7
  - First commit
data/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Create beautiful static maps with one line of Ruby. No more fighting with mapping libraries!
4
4
 
5
- [See it in action](https://chartkick.com/mapkick-static)
5
+ [See it in action](#maps)
6
6
 
7
7
  :fire: For JavaScript maps, check out [Mapkick](https://chartkick.com/mapkick)
8
8
 
@@ -22,12 +22,16 @@ Mapkick Static uses the [Mapbox Static Images API](https://docs.mapbox.com/api/m
22
22
 
23
23
  Point map
24
24
 
25
+ <img src="https://chartkick.com/mapkick-static/map-2x?v3" alt="Point map" width="100%" height="100%">
26
+
25
27
  ```erb
26
28
  <%= static_map [{latitude: 37.7829, longitude: -122.4190}] %>
27
29
  ```
28
30
 
29
31
  Area map (experimental)
30
32
 
33
+ <img src="https://chartkick.com/mapkick-static/area-map-2x?v1" alt="Area map" width="100%" height="100%">
34
+
31
35
  ```erb
32
36
  <%= static_area_map [{geometry: {type: "Polygon", coordinates: ...}}] %>
33
37
  ```
@@ -48,7 +48,9 @@ module Mapkick
48
48
  end
49
49
 
50
50
  def set_viewport(geojson)
51
- if geojson[:features].size == 1 && (geometry = geojson[:features][0][:geometry]) && geometry&.[](:type) == "MultiPoint" && geometry[:coordinates].size == 1
51
+ if geojson[:features].empty?
52
+ "0,0,0"
53
+ elsif geojson[:features].size == 1 && (geometry = geojson[:features][0][:geometry]) && geometry&.[](:type) == "MultiPoint" && geometry[:coordinates].size == 1
52
54
  coordinates = geometry[:coordinates][0]
53
55
  zoom = 15
54
56
  "%f,%f,%d" % [round_coordinate(coordinates[0].to_f), round_coordinate(coordinates[1].to_f), zoom.to_i]
@@ -1,5 +1,5 @@
1
1
  module Mapkick
2
2
  module Static
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mapkick-static
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-26 00:00:00.000000000 Z
11
+ date: 2023-05-03 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: andrew@ankane.org
@@ -25,7 +25,7 @@ files:
25
25
  - lib/mapkick/static/helper.rb
26
26
  - lib/mapkick/static/map.rb
27
27
  - lib/mapkick/static/version.rb
28
- homepage: https://chartkick.com/mapkick-static
28
+ homepage: https://github.com/ankane/mapkick-static
29
29
  licenses:
30
30
  - MIT
31
31
  metadata: {}