charta 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/charta/geo_json.rb +6 -1
- data/lib/charta/geometry.rb +2 -2
- data/lib/charta/gml.rb +1 -1
- data/lib/charta/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7330e4893e3f07c1558d79a93fd56077ed7a6e38
|
4
|
+
data.tar.gz: d101ae5be607fd0a6ce27447c03504a74cdfd03a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a779aff4072ca8118cb65e66b711816b51e1a6f2194b520a174c5b7549072afe064581e245940c59fcf7126274b1f463d732792b17101dcf044fa57891dcee2
|
7
|
+
data.tar.gz: a68643928b9578e298b665d8f576b3a51f95e3b8635aa6231501f886e57a5eb1d866c915d604d64c4a691d535b1b654a6fd30757e78bba5fb871f83994d5c683
|
data/lib/charta/geo_json.rb
CHANGED
@@ -98,7 +98,12 @@ module Charta
|
|
98
98
|
end.join(', ') + ')'
|
99
99
|
end
|
100
100
|
|
101
|
-
|
101
|
+
def geometry_collection_to_ewkt(hash)
|
102
|
+
return 'GEOMETRYCOLLECTION EMPTY' if hash['geometries'].nil?
|
103
|
+
'GEOMETRYCOLLECTION(' + hash['geometries'].collect do |feature|
|
104
|
+
object_to_ewkt(feature)
|
105
|
+
end.join(', ') + ')'
|
106
|
+
end
|
102
107
|
|
103
108
|
def feature_to_ewkt(hash)
|
104
109
|
object_to_ewkt(hash['geometry'])
|
data/lib/charta/geometry.rb
CHANGED
@@ -129,7 +129,7 @@ module Charta
|
|
129
129
|
# Computes the geometric center of a geometry, or equivalently, the center
|
130
130
|
# of mass of the geometry as a POINT.
|
131
131
|
def centroid
|
132
|
-
return nil unless surface?
|
132
|
+
return nil unless surface? && !@feature.is_empty?
|
133
133
|
point = @feature.centroid
|
134
134
|
[point.y, point.x]
|
135
135
|
end
|
@@ -155,7 +155,7 @@ module Charta
|
|
155
155
|
as_multi_type = "multi_#{as_type}".to_sym
|
156
156
|
if type == as_type
|
157
157
|
items << @feature
|
158
|
-
elsif
|
158
|
+
elsif type == :geometry_collection
|
159
159
|
@feature.each do |geom|
|
160
160
|
type_name = Charta.underscore(geom.geometry_type.type_name).to_sym
|
161
161
|
if type_name == as_type
|
data/lib/charta/gml.rb
CHANGED
@@ -72,7 +72,7 @@ module Charta
|
|
72
72
|
|
73
73
|
def document_to_ewkt(gml, srid)
|
74
74
|
# whole document
|
75
|
-
if gml.css("#{OGR_PREFIX}|FeatureCollection").
|
75
|
+
if gml.css("#{OGR_PREFIX}|FeatureCollection").empty? || gml.css("#{GML_PREFIX}|featureMember").empty?
|
76
76
|
# fragment
|
77
77
|
if gml.root.name && TAGS.include?(gml.root.name)
|
78
78
|
object_to_ewkt(gml.root, srid)
|
data/lib/charta/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.6
|
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
|
11
|
+
date: 2017-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|