fc2json

When querying a esri feature service to get all data published through it, it is needed to deal with the limitation on the number of records returned by the server. fc2json abstracts the tasks needed to get all data from a esri feature service.

Usage

Install the gem as usual:

gem install fc2json

Create an instance of a FC2Json object, passing it the service url as a parameter. After creating the instance, just call the get method on it to get a json object with all the data exposed by the service. The following code presents a sample on downloading and saving the service data to a file:

File.open("output.json", 'w') do |file|
        file.write FC2Json.new("http://services2.arcgis.com/hMIIIBIOpi8Cdgjw/arcgis/rest/services/ubs/FeatureServer/0").get
end

Initialization parameters

The constructor of a FC2Json object is declared as follows:

def initialize (service_url, object_identifier_field_name = nil, records_per_request = nil, where_clause = nil)
end

The construction parameters are:

Binary usage

If you prefer you can use the binary provided by the gem and redirect the output to a file:

fc2json "http://services2.arcgis.com/hMIIIBIOpi8Cdgjw/arcgis/rest/services/ubs/FeatureServer/0" "FID" 6 "FID >= 1 and FID <=6" > output.json

Contributing to fc2json

Copyright © 2013 rpepato. See LICENSE.txt for further details.