gb_mapfish_appserver 1.0.5 → 1.0.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 +8 -8
- data/app/controllers/geo_controller.rb +5 -6
- data/app/models/geo_model.rb +15 -8
- data/app/models/layer.rb +10 -0
- data/lib/gb_mapfish_appserver/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjcyMGM2NTljZDgyZjdhZmQ3YzA4MzNiYzFmMGFmM2IwZWY0ZmUzYg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ODFhZGY1NThiOGQ1ODkxMzRhY2U1MDQzZTcyNjUyYjAwYWU5NGFmZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
OThjMDNmNWIwM2FkODMwN2Y0OTQ0NjZiYjFjN2ViZjRmOTZhM2Q2MGNlOTlk
|
10
|
+
M2RjNjliNWYxZDgyYjRjMTRjOTM5NzU1YWMxNDg4YzZhYjg5ZGJhMDFjNWQ5
|
11
|
+
YzZmYzNlMGNmYTI5M2NkNDMyYWY1ZjY1NzczOWI1MDBhNTgzYWY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MTFjMzlhMzM3MmVlNWQ5NWE5MzFjY2E5OWQ1NmU0NjdiNmIxN2I0MWIyNzkx
|
14
|
+
NzYwMzQ3MjFjZGMzZDhjNjg5NjJmNTVjOWMyMGE0MDFlYjliMTk4NWE1Yzli
|
15
|
+
MmY1YjAyNmIyNTllNmU0YjY1ODc5MzhlN2Y5ZTAwNjgzOGU3ZDM=
|
@@ -46,6 +46,7 @@ class GeoController < ApplicationController
|
|
46
46
|
@features << new_feature
|
47
47
|
else
|
48
48
|
head :unprocessable_entity
|
49
|
+
return
|
49
50
|
end
|
50
51
|
end
|
51
52
|
|
@@ -53,18 +54,16 @@ class GeoController < ApplicationController
|
|
53
54
|
end
|
54
55
|
|
55
56
|
def update
|
56
|
-
|
57
|
+
# NOTE: user_filter checks if model is editable
|
58
|
+
feature = geo_model.user_filter(current_ability).geojson_decode(request.raw_post)
|
57
59
|
if feature.nil?
|
58
60
|
head :bad_request
|
59
61
|
return
|
60
62
|
end
|
61
63
|
|
62
64
|
if feature.feature_id.is_a? Integer
|
63
|
-
|
64
|
-
|
65
|
-
if @feature.nil?
|
66
|
-
head :not_found
|
67
|
-
return
|
65
|
+
# NOTE: user_filter may limit editable features; find raises RecordNotFound if feature cannot be found
|
66
|
+
@feature = geo_model.user_filter(current_ability).find(feature.feature_id)
|
68
67
|
end
|
69
68
|
|
70
69
|
if @feature.update_attributes_from_geojson_feature(feature, current_user)
|
data/app/models/geo_model.rb
CHANGED
@@ -84,14 +84,21 @@ class GeoModel < ActiveRecord::Base
|
|
84
84
|
#end
|
85
85
|
|
86
86
|
def bbox
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
87
|
+
if respond_to?('extent')
|
88
|
+
# use extent from select(extent_field)
|
89
|
+
envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo
|
90
|
+
[envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]
|
91
|
+
else
|
92
|
+
# get Box2D for this feature
|
93
|
+
box_query = "Box2D(#{connection.quote_column_name(self.class.geometry_column_name)})"
|
94
|
+
extent = self.class.select("ST_XMin(#{box_query}), ST_YMin(#{box_query}), ST_XMax(#{box_query}), ST_Ymax(#{box_query})").find(id)
|
95
|
+
[
|
96
|
+
extent.st_xmin.to_f,
|
97
|
+
extent.st_ymin.to_f,
|
98
|
+
extent.st_xmax.to_f,
|
99
|
+
extent.st_ymax.to_f
|
100
|
+
]
|
101
|
+
end
|
95
102
|
end
|
96
103
|
|
97
104
|
# based on mapfish_filter
|
data/app/models/layer.rb
CHANGED
@@ -76,6 +76,16 @@ class Layer < ActiveRecord::Base
|
|
76
76
|
self.table_name = '#{table}'
|
77
77
|
self.primary_key = '#{pkey}'
|
78
78
|
|
79
|
+
if self.primary_key == 'oid'
|
80
|
+
# include oid in attributes
|
81
|
+
default_scope select("*").select(self.primary_key)
|
82
|
+
|
83
|
+
# return oid as id
|
84
|
+
def id
|
85
|
+
read_attribute(self.class.primary_key)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
79
89
|
self
|
80
90
|
end
|
81
91
|
EOS
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gb_mapfish_appserver
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pirmin Kalberer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08
|
11
|
+
date: 2015-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|