featureservice
Advanced tools
Comparing version 1.5.1 to 1.5.2
@@ -5,2 +5,7 @@ # Change Log | ||
## [1.5.2] - 2016-03-03 | ||
### Fixed | ||
* Get the object id field if it's explicitly in info properties | ||
* resultOffset strategy was reversed | ||
## [1.5.1] - 2016-03-02 | ||
@@ -189,2 +194,3 @@ ### Changed | ||
[1.5.2]: https://github.com/koopjs/featureservice/compare/v1.5.1...v1.5.2 | ||
[1.5.1]: https://github.com/koopjs/featureservice/compare/v1.5.0...v1.5.1 | ||
@@ -191,0 +197,0 @@ [1.5.0]: https://github.com/koopjs/featureservice/compare/v1.4.6...v1.5.0 |
@@ -236,7 +236,10 @@ var queue = require('async').queue | ||
if (!info.fields) return false | ||
info.fields.forEach(function (field) { | ||
if (info.objectIdField) return info.objectIdField | ||
info.fields.some(function (field) { | ||
if (field.type === 'esriFieldTypeOID') { | ||
oid = field.name | ||
return true | ||
} | ||
}) | ||
return oid | ||
@@ -346,3 +349,3 @@ } | ||
var canPage = layer.advancedQueryCapabilities && layer.advancedQueryCapabilities.supportsPagination | ||
if (canPage && !this.hosted) return callback(null, this._offsetPages(nPages, size)) | ||
if (canPage && this.hosted) return callback(null, this._offsetPages(nPages, size)) | ||
@@ -569,3 +572,2 @@ if (!meta.oid) return callback(new Error('ObjectID type field not found, unable to page')) | ||
} catch (e) { | ||
console.log(e) | ||
// sometimes we get html or plain strings back | ||
@@ -572,0 +574,0 @@ var pattern = new RegExp(/[^{\[]/) |
{ | ||
"name": "featureservice", | ||
"description": "Get all features from an Esri Feature Service", | ||
"version": "1.5.1", | ||
"version": "1.5.2", | ||
"author": "Chris Helm", | ||
@@ -6,0 +6,0 @@ "bugs": { |
@@ -14,2 +14,3 @@ var sinon = require('sinon') | ||
var layerInfo = JSON.parse(fs.readFileSync('./test/fixtures/layerInfo.json')) | ||
var hostedLayerInfo = JSON.parse(fs.readFileSync('./test/fixtures/hostedLayerInfo.json')) | ||
var layerFixture = JSON.parse(fs.readFileSync('./test/fixtures/layer.json')) | ||
@@ -41,2 +42,9 @@ var idFixture = JSON.parse(fs.readFileSync('./test/fixtures/objectIds.json')) | ||
test('get the from a hosted service', function (t) { | ||
var oid = service.getObjectIdField(hostedLayerInfo) | ||
t.equal(oid, 'FID') | ||
t.end() | ||
}) | ||
test('try to get the objectId when there are no fields', function (t) { | ||
@@ -402,11 +410,12 @@ var layer = _.cloneDeep(layerInfo) | ||
var layerPaging = JSON.parse(fs.readFileSync('./test/fixtures/layerPaging.json')) | ||
var fixture = nock('http://maps.indiana.edu') | ||
var fixture = nock('http://services3.arcgis.com') | ||
fixture.get('/ArcGIS/rest/services/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0/query?where=1=1&returnCountOnly=true&f=json') | ||
fixture.get('/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0/query?where=1=1&returnCountOnly=true&f=json') | ||
.reply(200, countPaging) | ||
fixture.get('/ArcGIS/rest/services/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0?f=json') | ||
fixture.get('/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0?f=json') | ||
.reply(200, layerPaging) | ||
var service = new FeatureService('http://maps.indiana.edu/ArcGIS/rest/services/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0', {}) | ||
var service = new FeatureService('http://services3.arcgis.com/Infrastructure/Railroads_Rail_Crossings_INDOT/MapServer/0', {}) | ||
console.log(service.hosted) | ||
service.pages(function (err, pages) { | ||
@@ -413,0 +422,0 @@ t.equal(err, null) |
1280817
32
1846