libgd-gis 0.4.9 → 0.5.0

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: 9b617161c82e9481b5787df8379b18b0f5bfc267dc62ae1d6979d0cacd92881d
4
- data.tar.gz: ec8b6d1c651b74dee77266186e5e5b767e7133f863bb51d9dded95b549c7cedc
3
+ metadata.gz: 9d3a1a097a70594f97c1bc94eaf18e02c1494b530b430c137051eb1bc9d3c293
4
+ data.tar.gz: 1c3d4d8b4c9476dd06eab30fa0708063a9f6605dda34a2d23690460d98713edb
5
5
  SHA512:
6
- metadata.gz: 8f9a191f2d884a477557cdc4e5efe69545cdf43f78528056f4b7f82ec1500dedb8015374fed929bb4035c1d0f27ce414aeaff018e2d4eb36802399408f5e41c1
7
- data.tar.gz: bb24e7dd4c41e7783d41e97ed7f6ddc8b01a8a0372c9ecdbb182666e977ed365856a10a35b7faf88a3dbbc35aaf52ff33b2e8090c915f3366f5ad32ad3af91f5
6
+ metadata.gz: '069642af657e39514e8b16f2076e25abb097f8174abd5612c2427c0a8e64041ac0d82dd5769a4712a946bde371db8b697c65043b290a889b7840f3580f885b65'
7
+ data.tar.gz: d20ceb5e7e8c129100f6e536a633d9ea2cb9f423852878a829563c0132d01014ce9221637cfdd1f8ed3ff32c50c95c734022eacb175b502e7683b81505cef0fa
@@ -77,17 +77,13 @@ module GD
77
77
  end
78
78
 
79
79
  def self.validate_geojson!(data)
80
- unless data.is_a?(Hash)
81
- raise ArgumentError, "GeoJSON must be an object"
82
- end
80
+ raise ArgumentError, "GeoJSON must be an object" unless data.is_a?(Hash)
83
81
 
84
- unless data["type"] == "FeatureCollection"
85
- raise ArgumentError, "Only FeatureCollection is supported"
86
- end
82
+ raise ArgumentError, "Only FeatureCollection is supported" unless data["type"] == "FeatureCollection"
87
83
 
88
- unless data["features"].is_a?(Array)
89
- raise ArgumentError, "GeoJSON must contain features array"
90
- end
84
+ return if data["features"].is_a?(Array)
85
+
86
+ raise ArgumentError, "GeoJSON must contain features array"
91
87
  end
92
88
 
93
89
  # Normalizes a GeoJSON geometry in-place.
data/lib/gd/gis/map.rb CHANGED
@@ -404,6 +404,10 @@ module GD
404
404
  @layers[:minor] << feature
405
405
  end
406
406
  end
407
+ puts "\n=== ONTOLOGY DEBUG ==="
408
+ puts "Properties: #{feature.properties}"
409
+ puts "Geometry: #{feature.geometry['type']}"
410
+ puts "→ Classified as: #{feature.layer.inspect}"
407
411
  end
408
412
  end
409
413
 
@@ -674,6 +678,10 @@ module GD
674
678
  items = @layers[kind]
675
679
  return if items.nil? || items.empty?
676
680
 
681
+ puts ">>>>>>debug<<<<<<"
682
+ puts kind
683
+
684
+
677
685
  style =
678
686
  case kind
679
687
  when :street, :primary, :motorway, :secondary, :minor
@@ -31,6 +31,20 @@ module GD
31
31
  @rules = YAML.load_file(path)
32
32
  end
33
33
 
34
+ def print_rules
35
+ @rules.each do |layer, sources|
36
+ puts "\n=== #{layer.to_s.upcase} ==="
37
+
38
+ sources.each do |source, rules|
39
+ puts " [#{source}]"
40
+
41
+ rules.each do |key, values|
42
+ puts " #{key} → #{values.join(', ')}"
43
+ end
44
+ end
45
+ end
46
+ end
47
+
34
48
  # Classifies a feature into a semantic layer.
35
49
  #
36
50
  # Properties are matched against ontology rules using
@@ -64,9 +78,16 @@ module GD
64
78
  end
65
79
 
66
80
  # Fallback classification
67
- return :points if geometry_type == "Point"
68
-
69
- nil
81
+ case geometry_type
82
+ when "Point"
83
+ :points
84
+ when "LineString", "MultiLineString"
85
+ :minor
86
+ when "Polygon", "MultiPolygon"
87
+ :area
88
+ else
89
+ nil
90
+ end
70
91
  end
71
92
  end
72
93
  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.4.9
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Germán Alberto Giménez Silva