Skip to content

Commit

Permalink
Merge pull request #181 from Esri/csv-fields
Browse files Browse the repository at this point in the history
Csv fields
  • Loading branch information
ungoldman committed Jun 3, 2015
2 parents 8e55b83 + 40a06df commit 0b5f250
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [2.1.10] - 2015-06-02
### Changed
* adding an object id to the list of fields when its missing for CSV data
* Files from S3 now get a the HEAD request data back when checking if files exist

## [2.1.9] - 2015-05-21
### Changed
* Sending any stored header/field lists to the featureserver code to support ordered fields coming from CSVs data.
Expand Down Expand Up @@ -244,6 +249,7 @@ Koop is now just a node module that exposes an express middleware app with hooks
- koop-server is no more; all central code is in the koop project
- to use Koop you must use it as middleware in an app that boots up an http server

[2.1.10]: https://github.com/Esri/koop/compare/v2.1.9...v2.1.10
[2.1.9]: https://github.com/Esri/koop/compare/v2.1.8...v2.1.9
[2.1.8]: https://github.com/Esri/koop/compare/v2.1.7...v2.1.8
[2.1.7]: https://github.com/Esri/koop/compare/v2.1.6...v2.1.7
Expand Down
9 changes: 8 additions & 1 deletion lib/FeatureServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,19 @@ module.exports = {
type,
fieldList;

var keys = Object.keys( props );

if (list) {
fieldList = list;
// if our keys and list are diff length we need to add an OID key
// also make sure no ID or OBJECID is already included
if (keys.length > list.length && (list.indexOf('OBJECTID') === -1 || list.indexOf('id') === -1 )) {
fieldList.push('OBJECTID');
}
} else {
fieldList = Object.keys( props );
}
fieldList.forEach(function( key ){
fieldList.forEach(function( key, i ){
if ( key === 'OBJECTID' && !idField){
idField = key;
}
Expand Down
12 changes: 7 additions & 5 deletions lib/Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,16 @@ var Files = function( koop ){
Bucket: [this.s3Bucket, subdir].join('/'),
Key: name
};
this.s3.getObjectAcl(params, function(err){
if (err){
this.s3.getObjectAcl(params, function (err) {
if (err) {
koop.log.info('File does not exist on S3 %s %s', self.s3Bucket, subdir, name);
callback( false );
} else {
self.s3.getSignedUrl( 'getObject', params, function ( err, url ) {
koop.log.info('File exists on S3 %s %s', self.s3Bucket, name);
callback( true, url.split('?')[0] );
self.s3.headObject(params, function (err, info) {
self.s3.getSignedUrl( 'getObject', params, function ( err, url, data ) {
koop.log.info('File exists on S3 %s %s', self.s3Bucket, name);
callback( true, url.split('?')[0], info );
});
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "koop",
"version": "2.1.9",
"version": "2.1.10",
"description": "A node module/express middleware for converting GeoJSON to Esri Feature Services.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 0b5f250

Please sign in to comment.