charta 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 6e8a91f2b818cc99ed6f77f938f4c38b70e9be7d
4
- data.tar.gz: 5a9de8a40efb3fcae10738f9630c508f11e42e50
3
+ metadata.gz: c8714ebcfc89f8507cf20d24450bfe64537f2466
4
+ data.tar.gz: 753ff77066f3443fb8fca493cbd4edf64011046c
5
5
  SHA512:
6
- metadata.gz: 55ba30dc33527c548e2105cd0c557884270811e0a17be36f4d2563ebce23e7d506f5f11f9bbc019c977407f80d3c5af945a9175e4a385762e3a486a0c8030e3d
7
- data.tar.gz: b66842d74f9ce47c4478b989f46c01fb59dd7ab01503c6eba6334f8cd1cfd6bb363869d2bfd064686c38fb1e4b60c43beb6a964f56545df567f5422a6ffe7444
6
+ metadata.gz: 10908d9cc9e07db0b3699f2b640324d2a4f96368ead65f26c74d15ab46374f452374306b19603ca3a891d88f5356171d8d5b8ccbed481b062a5ba357e4f30a99
7
+ data.tar.gz: 674cb95b22abc9604d7eaeb9076c805d3afc752af532260f586810457d99f774823abcfe309c98906afed1945588efb4453f216ce11474bc737eedcc65480f8f
@@ -42,7 +42,7 @@ module Charta
42
42
 
43
43
  # Returns the Well-Known Text (WKT) representation of the geometry/geography without SRID metadata
44
44
  def to_text
45
- @feature.as_text
45
+ @feature.as_text.match(/\ASRID=.*;(.*)/)[1]
46
46
  end
47
47
  alias as_text to_text
48
48
  alias to_wkt to_text
@@ -236,8 +236,8 @@ module Charta
236
236
  @feature
237
237
  end
238
238
 
239
- def to_json_feature
240
- { type: 'Feature', geometry: to_json_object }
239
+ def to_json_feature(properties = {})
240
+ { type: 'Feature', properties: properties, geometry: to_json_object }
241
241
  end
242
242
 
243
243
  class << self
@@ -7,11 +7,14 @@ module Charta
7
7
  new(feature)
8
8
  end
9
9
 
10
- def to_json_feature_collection
11
- features = []
12
- feature.each do |f|
13
- features << Charta.new_geometry(f).to_json_feature
10
+ def to_json_feature_collection(collection_properties = [])
11
+ features = feature.each.with_index.collect do |f,i|
12
+ properties = {}
13
+ properties = collection_properties[i] unless collection_properties[i].nil?
14
+
15
+ Charta.new_geometry(f).to_json_feature(properties)
14
16
  end
17
+
15
18
  { type: 'FeatureCollection', features: features }
16
19
  end
17
20
  end
@@ -1,3 +1,3 @@
1
1
  module Charta
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: charta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brice TEXIER
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2017-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri