Class: ArcREST::Layer
- Includes:
- Attributable
- Defined in:
- lib/arcrest/layer.rb
Overview
a layer
Constant Summary collapse
- E =
'error'.freeze
- DATE =
'esriFieldTypeDate'.freeze
- ATTRIBUTES =
%w[id name type drawing_info fields max_record_count].freeze
- DEFAULT_PARAMS =
{ where: '1=1', outFields: '*' }.freeze
- PARAMS =
%w[distance geometry geometryType inSR objectIds outFields outSR relationParam returnDistinceValues returnIdsOnly spatialRel time where].freeze
- PARAMS_SP1 =
%w[returnCountOnly].freeze
- PARAMS_10_1 =
%w[dbVersion geometryPrecision groupByFieldsForStatistics maxAllowableOffset multiPatchOption orderByFields outStatistics returnGeometry returnM returnZ].freeze
- PARAMS_10_3 =
%w[returnExtentOnly resultOffset resultRecordCount].freeze
Constants inherited from Server
Server::BAD_ENDPOINT, Server::REGEX
Instance Attribute Summary collapse
-
#valid_params ⇒ Object
readonly
other accessors set in constructor.
Attributes inherited from Server
Instance Method Summary collapse
- #count ⇒ Object
- #features(options = {}) ⇒ Object
-
#initialize(url) ⇒ Layer
constructor
A new instance of Layer.
-
#object_ids ⇒ Object
care - must specify outFields to overide default ‘*’.
- #query(options = {}) ⇒ Object
- #valid_opts ⇒ Object
Methods included from Attributable
#create_getter, #create_method, #create_setter, #set_attr
Constructor Details
#initialize(url) ⇒ Layer
Returns a new instance of Layer.
23 24 25 26 27 |
# File 'lib/arcrest/layer.rb', line 23 def initialize(url) super generate_attributes # dynamically create & assign values to attributes :) @fields = fields end |
Instance Attribute Details
#valid_params ⇒ Object (readonly)
other accessors set in constructor
21 22 23 |
# File 'lib/arcrest/layer.rb', line 21 def valid_params @valid_params end |
Instance Method Details
#count ⇒ Object
29 30 31 |
# File 'lib/arcrest/layer.rb', line 29 def count @version > 10 ? count_only_true : object_ids.count # v10.1 onwards end |
#features(options = {}) ⇒ Object
42 43 44 |
# File 'lib/arcrest/layer.rb', line 42 def features( = {}) query()['features'] end |
#object_ids ⇒ Object
care - must specify outFields to overide default ‘*’
33 34 35 |
# File 'lib/arcrest/layer.rb', line 33 def object_ids # care - must specify outFields to overide default '*' query(outFields: nil, returnIdsOnly: true)['objectIds'] end |
#query(options = {}) ⇒ Object
37 38 39 40 |
# File 'lib/arcrest/layer.rb', line 37 def query( = {}) validate(.keys.map(&:to_s).sort) valid_resp(build_uri, DEFAULT_PARAMS.merge()) end |
#valid_opts ⇒ Object
46 47 48 49 50 51 |
# File 'lib/arcrest/layer.rb', line 46 def valid_opts return PARAMS if @version < 10 || @version == 10.0 return (PARAMS + PARAMS_SP1).sort if @version < 10.1 return (PARAMS + PARAMS_SP1 + PARAMS_10_1).sort if @version < 10.2 (PARAMS + PARAMS_SP1 + PARAMS_10_1 + PARAMS_10_3).sort end |