Skip to content

Commit

Permalink
Merge pull request #976 from jgravois/transform
Browse files Browse the repository at this point in the history
add support for datum transformations
  • Loading branch information
jgravois authored Jul 20, 2017
2 parents b6c3827 + 98ca7e2 commit 66c1116
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
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

0 comments on commit 66c1116

Please sign in to comment.