Class: ArcREST::Layer
- Includes:
- Attributable
- Defined in:
- lib/arcrest/layer.rb
Overview
a layer
Constant Summary collapse
- DATE =
'esriFieldTypeDate'- 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::ENDPOINT_REGEX
Constants included from Curlable
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, headers = {}) ⇒ Layer
constructor
A new instance of Layer.
- #object_ids ⇒ Object
- #query(options = {}) ⇒ Object
- #valid_opts ⇒ Object
Methods included from Attributable
#create_getter, #create_method, #create_setter, #set_attr
Methods included from Curlable
Constructor Details
#initialize(url, headers = {}) ⇒ Layer
Returns a new instance of Layer.
26 27 28 29 30 |
# File 'lib/arcrest/layer.rb', line 26 def initialize(url, headers = {}) super generate_attributes # dynamically create & assign values to attributes :) @fields = fields end |
Instance Attribute Details
#valid_params ⇒ Object (readonly)
other accessors set in constructor
24 25 26 |
# File 'lib/arcrest/layer.rb', line 24 def valid_params @valid_params end |
Instance Method Details
#count ⇒ Object
32 33 34 |
# File 'lib/arcrest/layer.rb', line 32 def count @version > 10 ? count_only_true : object_ids.count # v10.1 onwards end |
#features(options = {}) ⇒ Object
45 46 47 |
# File 'lib/arcrest/layer.rb', line 45 def features( = {}) query()['features'] end |
#object_ids ⇒ Object
36 37 38 |
# File 'lib/arcrest/layer.rb', line 36 def object_ids query(outFields: nil, returnIdsOnly: true)['objectIds'] # care - must specify outFields to overide default '*' end |
#query(options = {}) ⇒ Object
40 41 42 43 |
# File 'lib/arcrest/layer.rb', line 40 def query( = {}) validate(.keys.map(&:to_s).sort) valid_resp(DEFAULT_PARAMS.merge()) end |
#valid_opts ⇒ Object
49 50 51 52 53 54 55 |
# File 'lib/arcrest/layer.rb', line 49 def valid_opts return PARAMS if @version < 10 || @version.to_s == '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 |