aboutsummaryrefslogtreecommitdiff
path: root/index.js
diff options
context:
space:
mode:
authorEvan Siroky <evan.siroky@yahoo.com>2017-10-14 23:47:21 -0700
committerEvan Siroky <evan.siroky@yahoo.com>2017-10-14 23:47:21 -0700
commit1bcd47720589af452514c85e6321ac0c0ce7b09b (patch)
tree5607a7bad652f7829e17a58560d30c10b680afae /index.js
parent62025215040969cb10345a5747994664eb3eb062 (diff)
downloadtimezone-boundary-builder-1bcd47720589af452514c85e6321ac0c0ce7b09b.tar.gz
Add Page, AZ to America/Phoenix
Also, add the ability to use ways that represent polygons in fetching overpass data. Fixes #9
Diffstat (limited to 'index.js')
-rw-r--r--index.js11
1 files changed, 9 insertions, 2 deletions
diff --git a/index.js b/index.js
index 9eabbd4..7782b52 100644
--- a/index.js
+++ b/index.js
@@ -136,13 +136,19 @@ var geomToGeoJsonString = function (geom) {
var downloadOsmBoundary = function (boundaryId, boundaryCallback) {
var cfg = osmBoundarySources[boundaryId]
- var query = '[out:json][timeout:60];(relation'
+ var query = '[out:json][timeout:60];('
+ if (cfg.way) {
+ query += 'way'
+ } else {
+ query += 'relation'
+ }
var boundaryFilename = './downloads/' + boundaryId + '.json'
var debug = 'getting data for ' + boundaryId
var queryKeys = Object.keys(cfg)
for (var i = queryKeys.length - 1; i >= 0; i--) {
var k = queryKeys[i]
+ if (k === 'way') continue
var v = cfg[k]
query += '["' + k + '"="' + v + '"]'
@@ -199,7 +205,8 @@ var downloadOsmBoundary = function (boundaryId, boundaryCallback) {
} catch (e) {
console.error('error converting overpass result to geojson')
console.error(e)
- fs.writeFileSync(boundaryId + '_convert_to_geom_error.json', JSON.stringify(data))
+ fs.writeFileSync(boundaryId + '_convert_to_geom_error.json', JSON.stringify(curOsmGeom))
+ fs.writeFileSync(boundaryId + '_convert_to_geom_error-all-features.json', JSON.stringify(data))
throw e
}
if (!combined) {