spatial_features 1.1.0 → 1.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
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0496bf44b507cc71cd17d396571571b0e570d186
|
4
|
+
data.tar.gz: 84fd524df708b02980322ed4e25099f1a161953c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6657cbe49b10cd0e4ecbc4111f4a37392d7ab6f1d1d1ce766707cd666cdb7556f1bbf4abacb0921ad5cf49bc280a6ebdfc502de895058b7e64fcb13220434779
|
7
|
+
data.tar.gz: e3fca9eeb653a4d4467417e77357fcee65180f0c97c66e05d7173f9a9f5368fae970fe2da02e4b2c4ca812ffaf0a7fafee954a9b0610e123b1729d2ed4661f94
|
@@ -11,29 +11,36 @@ class ArcGISUpdateFeaturesJob < Struct.new(:options)
|
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
+
NUMBER_REGEX = /-?\d+\.\d+/
|
15
|
+
|
14
16
|
def normalize_message(message)
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
normalized_messages = []
|
18
|
+
|
19
|
+
normalized_messages << "ArcGIS Server is not responding." if message =~ /\Agetaddrinfo/
|
20
|
+
|
21
|
+
if message =~ /invalid KML representation/
|
22
|
+
normalized_messages += invalid_kml_reason(message).presence || ["invalid KML being generated by ArcGIS."]
|
23
|
+
end
|
24
|
+
|
25
|
+
if message =~ /Self-intersection/
|
26
|
+
normalized_messages += message.scan(/\[(#{NUMBER_REGEX}) (#{NUMBER_REGEX})\]/).collect do |lng, lat|
|
21
27
|
"Self-intersection at #{lng},#{lat}"
|
22
|
-
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
if normalized_messages.present?
|
32
|
+
return '<ul><li>' + normalized_messages.join('</li><li>') + '</li></ul>'
|
23
33
|
else
|
24
|
-
message
|
34
|
+
return message
|
25
35
|
end
|
26
36
|
end
|
27
37
|
|
28
|
-
NUMBER_REGEX = /-?\d+\.\d+/
|
29
38
|
COORDINATE_REGEX = /<LinearRing><coordinates>\s*((?:#{NUMBER_REGEX},#{NUMBER_REGEX},#{NUMBER_REGEX}\s*)+)<\/coordinates><\/LinearRing>/
|
30
39
|
def invalid_kml_reason(message)
|
31
|
-
message.scan(COORDINATE_REGEX) do |match|
|
40
|
+
message.scan(COORDINATE_REGEX).collect do |match|
|
32
41
|
coords = match[0].split(/(?:,0\.0+)?\s+/).chunk {|c| c }.map(&:first)
|
33
42
|
|
34
|
-
|
35
|
-
end
|
36
|
-
|
37
|
-
return nil
|
43
|
+
"Sliver polygon detected at #{coords.first}" if coords.length < 4
|
44
|
+
end.compact
|
38
45
|
end
|
39
46
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spatial_features
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ryan Wallace
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|