-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ced46f6
commit e90527f
Showing
6 changed files
with
40 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
class GeojsonDownload < Download | ||
GEOJSON_DOWNLOAD_PARAMS = { | ||
service: 'wfs', | ||
version: '2.0.0', | ||
request: 'GetFeature', | ||
srsName: 'EPSG:4326', | ||
outputformat: 'application/json' | ||
} | ||
|
||
def initialize(document) | ||
request_params = GEOJSON_DOWNLOAD_PARAMS.merge(typeName: document[:layer_id_s]) | ||
super(document, { | ||
type: 'geojson', | ||
extension: 'json', | ||
request_params: request_params, | ||
content_type: 'application/json', | ||
service_type: 'wfs' | ||
}) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
require 'spec_helper' | ||
|
||
describe GeojsonDownload do | ||
let(:document) { SolrDocument.new(layer_slug_s: 'test', solr_wfs_url: 'http://www.example.com/wfs', layer_id_s: 'stanford-test', solr_bbox: '-180 -90 180 90') } | ||
let(:download) { GeojsonDownload.new(document) } | ||
describe '#initialize' do | ||
it 'should initialize as a GeojsonDownload object with specific options' do | ||
expect(download).to be_an GeojsonDownload | ||
options = download.instance_variable_get(:@options) | ||
expect(options[:content_type]).to eq 'application/json' | ||
expect(options[:request_params][:typeName]).to eq 'stanford-test' | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters