Skip to content

Commit

Permalink
just query, for now
Browse files Browse the repository at this point in the history
  • Loading branch information
jgravois committed Jul 20, 2017
1 parent 94ada64 commit 5d053bf
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 54 deletions.
36 changes: 18 additions & 18 deletions spec/Tasks/FindSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,29 +169,29 @@ describe('L.esri.Find', function () {
server.respond();
});

it('should pass through a simple datum transformation when finding features', function (done) {
server.respondWith('GET', mapServiceUrl + 'find?sr=4326&contains=true&returnGeometry=false&returnZ=true&returnM=false&layers=0&searchText=Site&datumTransformations=1234&f=json', JSON.stringify(sampleResponseWithoutGeometry));
// it('should pass through a simple datum transformation when finding features', function (done) {
// server.respondWith('GET', mapServiceUrl + 'find?sr=4326&contains=true&returnGeometry=false&returnZ=true&returnM=false&layers=0&searchText=Site&datumTransformations=1234&f=json', JSON.stringify(sampleResponseWithoutGeometry));

task.layers('0').text('Site').returnGeometry(false).transform(1234).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleFeatureCollectionWithoutGeometry);
expect(raw).to.deep.equal(sampleResponseWithoutGeometry);
done();
});
// task.layers('0').text('Site').returnGeometry(false).transform(1234).run(function (error, featureCollection, raw) {
// expect(featureCollection).to.deep.equal(sampleFeatureCollectionWithoutGeometry);
// expect(raw).to.deep.equal(sampleResponseWithoutGeometry);
// done();
// });

server.respond();
});
// server.respond();
// });

it('should pass through a JSON datum transformation when finding features', function (done) {
server.respondWith('GET', mapServiceUrl + 'find?sr=4326&contains=true&returnGeometry=false&returnZ=true&returnM=false&layers=0&searchText=Site&datumTransformations=%7B%22wkid%22%3A1234%7D&f=json', JSON.stringify(sampleResponseWithoutGeometry));
// it('should pass through a JSON datum transformation when finding features', function (done) {
// server.respondWith('GET', mapServiceUrl + 'find?sr=4326&contains=true&returnGeometry=false&returnZ=true&returnM=false&layers=0&searchText=Site&datumTransformations=%7B%22wkid%22%3A1234%7D&f=json', JSON.stringify(sampleResponseWithoutGeometry));

task.layers('0').text('Site').returnGeometry(false).transform({'wkid': 1234}).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleFeatureCollectionWithoutGeometry);
expect(raw).to.deep.equal(sampleResponseWithoutGeometry);
done();
});
// task.layers('0').text('Site').returnGeometry(false).transform({'wkid': 1234}).run(function (error, featureCollection, raw) {
// expect(featureCollection).to.deep.equal(sampleFeatureCollectionWithoutGeometry);
// expect(raw).to.deep.equal(sampleResponseWithoutGeometry);
// done();
// });

server.respond();
});
// server.respond();
// });

it('should identify features with a token', function (done) {
server.respondWith('GET', mapServiceUrl + 'find?sr=4326&contains=true&returnGeometry=true&returnZ=true&returnM=false&layers=0&searchText=Site&token=foo&f=json', JSON.stringify(sampleResponse));
Expand Down
47 changes: 24 additions & 23 deletions spec/Tasks/IdentifyFeaturesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,29 +191,30 @@ describe('L.esri.IdentifyFeatures', function () {
request.respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify(sampleResponse));
});

it('should pass through a simple datum transformation when identifying features', function (done) {
var request = task.transform(1234).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleFeatureCollection);
expect(raw).to.deep.equal(sampleResponse);
done();
});

expect(request.url).to.contain('datumTransformations=1234');

request.respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify(sampleResponse));
});

it('should pass through a JSON datum transformation when identifying features', function (done) {
var request = task.transform({'wkid': 1234}).run(function (error, featureCollection, raw) {
expect(featureCollection).to.deep.equal(sampleFeatureCollection);
expect(raw).to.deep.equal(sampleResponse);
done();
});

expect(request.url).to.contain('datumTransformations=%7B%22wkid%22%3A1234%7D');

request.respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify(sampleResponse));
});
// it('should pass through a simple datum transformation when identifying features', function (done) {
// // this'd be easier if our implementation for passing through datum transformations was consistent
// var request = task.transform([1234]).run(function (error, featureCollection, raw) {
// expect(featureCollection).to.deep.equal(sampleFeatureCollection);
// expect(raw).to.deep.equal(sampleResponse);
// done();
// });

// expect(request.url).to.contain('datumTransformations=%5B1234%5D');

// request.respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify(sampleResponse));
// });

// it('should pass through a JSON datum transformation when identifying features', function (done) {
// var request = task.transform([{'wkid': 1234}]).run(function (error, featureCollection, raw) {
// expect(featureCollection).to.deep.equal(sampleFeatureCollection);
// expect(raw).to.deep.equal(sampleResponse);
// done();
// });

// expect(request.url).to.contain('datumTransformations=%5B%7B%22wkid%22%3A1234%7D%5D');

// request.respond(200, { 'Content-Type': 'text/plain; charset=utf-8' }, JSON.stringify(sampleResponse));
// });

it('should identify features within a certain pixel tolerance', function (done) {
var request = task.tolerance(4).run(function (error, featureCollection, raw) {
Expand Down
4 changes: 2 additions & 2 deletions spec/Tasks/QuerySpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ describe('L.esri.Query', function () {
});

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=*&datumTransformations=1234&f=json', JSON.stringify(sampleMapServiceQueryResponse));
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});

Expand All @@ -731,7 +731,7 @@ describe('L.esri.Query', function () {
});

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=*&datumTransformations=%7B%22wkid%22%3A1234%7D&f=json', JSON.stringify(sampleMapServiceQueryResponse));
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});

Expand Down
14 changes: 7 additions & 7 deletions src/Layers/DynamicMapLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@ export var DynamicMapLayer = RasterLayer.extend({
return this;
},

setTransform: function (datumTransformations) {
this.options.transform = datumTransformations;
return this;
},
// setTransform: function (datumTransformations) {
// this.options.transform = datumTransformations;
// return this;
// },

query: function () {
return this.service.query();
Expand Down Expand Up @@ -143,9 +143,9 @@ export var DynamicMapLayer = RasterLayer.extend({
params.time = this.options.from.valueOf() + ',' + this.options.to.valueOf();
}

if (this.options.transform) {
params.datumTransformations = typeof this.options.transform === 'string' ? this.options.transform : JSON.stringify(this.options.transform);
}
// if (this.options.transform) {
// params.datumTransformations = typeof this.options.transform === 'string' ? this.options.transform : JSON.stringify(this.options.transform);
// }

if (this.service.options.token) {
params.token = this.service.options.token;
Expand Down
2 changes: 1 addition & 1 deletion src/Tasks/Find.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export var Find = Task.extend({
'returnZ': 'returnZ',
'returnM': 'returnM',
'gdbVersion': 'gdbVersion',
'transform': 'datumTransformations',
// 'transform': 'datumTransformations',
'token': 'token'
},

Expand Down
4 changes: 2 additions & 2 deletions src/Tasks/IdentifyFeatures.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ export var IdentifyFeatures = Identify.extend({
'layers': 'layers',
'precision': 'geometryPrecision',
'tolerance': 'tolerance',
'returnGeometry': 'returnGeometry',
'transform': 'datumTransformations'
// 'transform': 'datumTransformations'
'returnGeometry': 'returnGeometry'
},

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

Expand Down

0 comments on commit 5d053bf

Please sign in to comment.