Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for datum transformations #976

Merged
merged 1 commit into from
Jul 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions spec/Tasks/QuerySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,34 @@ describe('L.esri.Query', function () {
server.respond();
});

it('should pass through a simple datum transformation when making a query', function (done) {
server.respondWith('GET', mapServiceUrl + '0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&datumTransformation=1234&f=json', JSON.stringify(sampleMapServiceQueryResponse));

var service = new L.esri.MapService({url: mapServiceUrl});

service.query().layer(0).transform(1234).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleMapServiceCollection);
expect(raw).to.deep.equal(sampleMapServiceQueryResponse);
done();
});

server.respond();
});

it('should pass through a JSON datum transformation when making a query', function (done) {
server.respondWith('GET', mapServiceUrl + '0/query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&datumTransformation=%7B%22wkid%22%3A1234%7D&f=json', JSON.stringify(sampleMapServiceQueryResponse));

var service = new L.esri.MapService({url: mapServiceUrl});

service.query().layer(0).transform({'wkid': 1234}).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleMapServiceCollection);
expect(raw).to.deep.equal(sampleMapServiceQueryResponse);
done();
});

server.respond();
});

it('should use a image service to query features', function (done) {
server.respondWith('GET', imageServiceUrl + 'query?returnGeometry=true&where=1%3D1&outSr=4326&outFields=*&pixelSize=1%2C1&f=json', JSON.stringify(sampleImageServiceQueryResponse));

Expand Down
2 changes: 2 additions & 0 deletions src/Tasks/Find.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export var Find = Task.extend({
'returnZ': 'returnZ',
'returnM': 'returnM',
'gdbVersion': 'gdbVersion',
// skipped implementing this (for now) because the REST service implementation isnt consistent between operations
// 'transform': 'datumTransformations',
'token': 'token'
},

Expand Down
2 changes: 2 additions & 0 deletions src/Tasks/IdentifyFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export var IdentifyFeatures = Identify.extend({
'layers': 'layers',
'precision': 'geometryPrecision',
'tolerance': 'tolerance',
// skipped implementing this (for now) because the REST service implementation isnt consistent between operations.
// 'transform': 'datumTransformations'
'returnGeometry': 'returnGeometry'
},

Expand Down
1 change: 1 addition & 0 deletions src/Tasks/Query.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export var Query = Task.extend({
'precision': 'geometryPrecision',
'featureIds': 'objectIds',
'returnGeometry': 'returnGeometry',
'transform': 'datumTransformation',
'token': 'token'
},

Expand Down