Skip to content

Commit

Permalink
add docs to newer functions
Browse files Browse the repository at this point in the history
changelog
  • Loading branch information
dmfenton committed Sep 24, 2015
1 parent 23a7cb2 commit ee8f119
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
* Gracefully handle malformed esri geoms in geojson conversion
* Revert Windows command line escaping, it was done improperly
* Always tranform datum for NAD83 exports

## [2.8.4] - 2015-09-24
### Fixed
Expand Down
36 changes: 36 additions & 0 deletions lib/Exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,15 @@ function fixWkt (inWkt, wkid) {
return wkt
}

/**
* Gets a set of OGR Paramters for an export
* @param {string} format - the output format
* @param {string} inFile - the geojson or vrt to use as a source
* @param {string} outFile - the file to write
* @param {object} geojson - a geojson object used in the xform
* @param {object} options - potentially contains a fields object
*/
function getOgrParams (format, inFile, outFile, geojson, options, callback) {
// escape quotes in file names
inFile = inFile.replace(/"/g, '"')
Expand Down Expand Up @@ -501,6 +510,14 @@ function getOgrParams (format, inFile, outFile, geojson, options, callback) {
}
}

/**
* Add parameters specific to a csv export
*
* @param {array} cmd - an array of OGR command parts to modify
* @param {object} options - may contain fields
* @return {array}
* @private
*/
function csvParams (cmd, options) {
var hasPointGeom = options.geometryType === 'Point'
var fields = options.fields.join('|').toLowerCase().split('|')
Expand All @@ -512,6 +529,14 @@ function csvParams (cmd, options) {
return cmd
}

/**
* Add parameters specific to a csv export
*
* @param {string} cmd - an array of OGR command parts to modify
* @param {object} options - may contain a wkid or wkt
* @param {function} callback - calls back back with a modified command array or an error
* @private
*/
function shapefileParams (cmd, options, callback) {
// make sure geometries are still written even if the first is null
cmd.push('-nlt ' + options.geometryType.toUpperCase())
Expand All @@ -530,6 +555,11 @@ function shapefileParams (cmd, options, callback) {
}
}

/**
* Adds final parameters to the OGR function call
* @param {array} cmd - an array of OGR command parts to modify
* @return {string} the final OGR command
*/
function finishOgrParams (cmd) {
cmd.push('-update')
cmd.push('-append')
Expand All @@ -539,6 +569,12 @@ function finishOgrParams (cmd) {
return cmd.join(' ')
}

/**
* Gets projection information for a shapefile exprot
* @param {object} options - contains info on spatial reference, wkid and wkt
* @param {function} callback - calls back with an error or wkt
* @private
*/
function addProjection (options, callback) {
// if there is a passed in WKT just use that
if (!options.sr) options.sr = {}
Expand Down

0 comments on commit ee8f119

Please sign in to comment.