class ArcServer::REST::FeatureServer

Attributes

url[R]

The REST url of a feature service

Public Class Methods

new(url) click to toggle source

@param [String] url the REST url of a map service @example ArcServer::MapServer.new(“sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/LandusePlanning/FeatureServer”)

# File lib/arcserver/rest/feature_server.rb, line 15
def initialize(url)
  @url = url
end

Public Instance Methods

applyEdits(layer, adds=[], updates=[], deletes=[]) click to toggle source
# File lib/arcserver/rest/feature_server.rb, line 19
def applyEdits(layer, adds=[], updates=[], deletes=[])
  options = { body: { f: 'json', rollbackOnFailure: 'true' } }
  options[:body].merge!( { adds: adds.to_json(only: [ :geometry, :attributes ]) } ) if adds.any?
  options[:body].merge!( { updates: updates.to_json(only: [ :geometry, :attributes ] ) } ) if updates.any?
  options[:body].merge!( { deletes: deletes } ) unless deletes.empty?
  results = self.class.post("#{@url}/#{layer}/applyEdits", options)
  results.with_indifferent_access
end