libgd-gis 0.2.4 → 0.2.6

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 31c9d884a7601b749b9ef7c51852ab27e440284a47535119ecb1715f8257e510
4
- data.tar.gz: 152d65acaabc7626f47c3ec2e77d71fa45479694395076727a71d598ebe84025
3
+ metadata.gz: 3c36a99210906574c046daffe2120213b027d92fdd22dec0b27861df22f88029
4
+ data.tar.gz: bd991fd3290c3bfb82f5640dad84c8e6486368285539774eed1b942acd7848b6
5
5
  SHA512:
6
- metadata.gz: 74debf00d8816b99beac0d59775b27b525c0b0f0db9cc41c39f2f48396e1cefcffd90a0ee658d9a1a08a89e6b661fa0547a21171bd638575bcd29c5e603ad967
7
- data.tar.gz: b8a4a1268a2da42c554c4b0fb24705fc3f1fcdab8915992aad113d6d611e3d4863ebe1eddf9c48050474c736ba54a23ea9d222f20a857ba80f65bf6faaadce9e
6
+ metadata.gz: 6bed27a3930a9512b0f5fff46fdfe2f76fe76932ddf263cc2d219cdaafd754d5161ede878f1b0d929e5a7b00b9c4b546c6905d9ee27d9bc478d5e7914ebc1784
7
+ data.tar.gz: ee203f7b9dc6f0a2669bbbedcde1e6fe31678c3a847c79a14d975c75cee1cc0a7f2784398acbef9b821943cce9124bdb5b41f0194070ff020fa39824f699a56a
data/README.md CHANGED
@@ -29,10 +29,15 @@
29
29
  </p>
30
30
 
31
31
  ![CI](https://github.com/ggerman/libgd-gis/actions/workflows/ci.yml/badge.svg)
32
+ [![Codacy Badge](https://api.codacy.com/project/badge/Grade/6bc3e7d6118d47e6959b16690b815909)](https://www.codacy.com/app/libgd-gis/libgd-gis?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=libgd-gis/libgd-gis&amp;utm_campaign=Badge_Grade)
33
+ [![Test Coverage](https://coveralls.io/repos/githublibgd-gis/libgd-gis/badge.svg?branch=master)](https://coveralls.io/github/libgd-gis/libgd-gis?branch=master)
34
+ [![Gem Version](https://img.shields.io/gem/v/libgd-gis.svg)](https://rubygems.org/gems/libgd-gis)
35
+
32
36
 
33
37
  | Examples | Examples | Examples |
34
38
  | :----: | :----: | :--: |
35
- | <img src="examples/nyc/nyc.png" height="250"> | <img src="examples/tokyo/tokyo.png" height="250"> | <img src="examples/parana/parana.png" height="250"> |
39
+ | <img src="docs/examples/parana.png" height="250"> | <img src="docs/examples/nyc.png" height="250"> | <img src="docs/examples/paris.png" height="250"> |
40
+ | <img src="examples/nyc/nyc.png" height="250"> | <img src="docs/examples/tokyo_solarized.png" height="250"> | <img src="examples/parana/parana.png" height="250"> |
36
41
  | <img src="docs/examples/america.png" height="250"> | <img src="docs/examples/argentina_museum.png" height="250"> | <img src="docs/examples/museos_parana.png" height="250"> |
37
42
  | <img src="docs/examples/asia.png" height="250"> | <img src="docs/examples/europe.png" height="250"> | <img src="docs/examples/icecream_parana.png" height="250"> |
38
43
  | <img src="docs/examples/argentina_cities.png" height="250"> | <img src="docs/examples/tanzania_hydro.png" height="250"> | <img src="docs/examples/parana_polygon.png" height="250"> |
@@ -40,6 +45,12 @@
40
45
 
41
46
  ---
42
47
 
48
+ > **libgd-gis is evolving very fast**, so some examples may temporarily stop working.
49
+ > Please report issues or ask for help — feedback is very welcome.
50
+ > https://github.com/ggerman/libgd-gis/issues or ggerman@gmail.com
51
+
52
+ --
53
+
43
54
  ## A geospatial raster engine for Ruby.
44
55
 
45
56
  libgd-gis allows Ruby to render real maps, GeoJSON layers, vector features, and geospatial tiles using a native raster backend powered by **libgd**.
data/lib/gd/gis/map.rb CHANGED
@@ -71,8 +71,30 @@ module GD
71
71
  @points_layers << GD::GIS::PointsLayer.new(data, **opts)
72
72
  end
73
73
 
74
- def add_lines(features, **opts)
75
- @lines_layers << GD::GIS::LinesLayer.new(features, **opts)
74
+ def add_line(coords, **opts)
75
+ feature = {
76
+ "type" => "Feature",
77
+ "geometry" => {
78
+ "type" => "LineString",
79
+ "coordinates" => coords
80
+ },
81
+ "properties" => {}
82
+ }
83
+
84
+ add_lines([feature], **opts)
85
+ end
86
+
87
+ def add_multiline(lines, **opts)
88
+ feature = {
89
+ "type" => "Feature",
90
+ "geometry" => {
91
+ "type" => "MultiLineString",
92
+ "coordinates" => lines
93
+ },
94
+ "properties" => []
95
+ }
96
+
97
+ add_lines([feature], **opts)
76
98
  end
77
99
 
78
100
  def add_polygons(polygons, **opts)
@@ -185,6 +207,17 @@ module GD
185
207
  end
186
208
  end
187
209
 
210
+ private
211
+
212
+ def add_lines(features, **opts)
213
+ stroke = opts.delete(:color) || opts.delete(:stroke)
214
+ width = opts.delete(:width) || opts.delete(:stroke_width)
215
+
216
+ raise ArgumentError, "missing :color or :stroke" unless stroke
217
+ raise ArgumentError, "missing :width" unless width
218
+
219
+ @lines_layers << GD::GIS::LinesLayer.new(features, :stroke => stroke, :width => width)
220
+ end
188
221
 
189
222
  end
190
223
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libgd-gis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Germán Alberto Giménez Silva
@@ -41,7 +41,6 @@ files:
41
41
  - lib/gd/gis.rb
42
42
  - lib/gd/gis/basemap.rb
43
43
  - lib/gd/gis/classifier.rb
44
- - lib/gd/gis/dump.sh
45
44
  - lib/gd/gis/feature.rb
46
45
  - lib/gd/gis/geometry.rb
47
46
  - lib/gd/gis/layer_geojson.rb
data/lib/gd/gis/dump.sh DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- set -e
4
-
5
- OUT="all_ruby_sources.txt"
6
- > "$OUT"
7
-
8
- echo "### Ruby sources dump ($(date))" >> "$OUT"
9
- echo >> "$OUT"
10
-
11
- find . -type f -name "*.rb" | sort | while read -r file; do
12
- echo "===== FILE: $file =====" >> "$OUT"
13
- echo >> "$OUT"
14
- cat "$file" >> "$OUT"
15
- echo >> "$OUT"
16
- echo >> "$OUT"
17
- done
18
-
19
- echo "Wrote $OUT"