當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript geojson-helpers.writeFileSync函數代碼示例

本文整理匯總了TypeScript中geojson-helpers.writeFileSync函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript writeFileSync函數的具體用法?TypeScript writeFileSync怎麽用?TypeScript writeFileSync使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了writeFileSync函數的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: require

import * as turf from '@turf/helpers'
import * as helpers from 'geojson-helpers'

const data: GeoJSON.FeatureCollection<any> = require('./halifax-buildings.json')
const collection = turf.featureCollection(
  data.features.map(feature => {
    feature.properties = {building: 'yes'}
    return feature
  })
)
helpers.writeFileSync('halifax-buildings.geojson', collection)
開發者ID:osmottawa,項目名稱:imports,代碼行數:11,代碼來源:clean.ts

示例2: function

}, function(err: any, data: GeoJSON.FeatureCollection<GeoJSON.Point>) {
  helpers.writeFileSync('address-points.geojson', data)
});
開發者ID:osmottawa,項目名稱:imports,代碼行數:3,代碼來源:convert-csv2geojson.ts

示例3:

import * as helpers from 'geojson-helpers'

const geojson = helpers.readFileSync('./GEBADR-address-points.geojson')
geojson.features = geojson.features.map(feature => {
  feature.properties.source = 'Canton Berne'
  return feature
}) 
helpers.writeFileSync('./GEBADR-address-points-compact.geojson', geojson, ['addr:housenumber', 'addr:postcode', 'addr:city', 'addr:street', 'source'])
開發者ID:osmottawa,項目名稱:imports,代碼行數:8,代碼來源:compact-geojson.ts

示例4: require

import * as concaveman from 'concaveman'
import * as helpers from 'geojson-helpers'
import * as turf from '@turf/turf'

const data = './halifax-buildings.json'
const geojson: GeoJSON.FeatureCollection<any> = require(data)
const points: Array<Array<number>> = []
geojson.features.map(feature => {
  turf.explode(feature).features.map(point => {
    points.push(point.geometry.coordinates)
  })
})
const extent = turf.polygon([concaveman(points)])
const buffer = turf.buffer(extent, 500, 'meters')
const simple: any = turf.simplify(buffer, 0.001, false)
helpers.writeFileSync('./extent.geojson', turf.featureCollection([extent]))
helpers.writeFileSync('./buffer.geojson', turf.featureCollection([buffer]))
helpers.writeFileSync('./simple.geojson', turf.featureCollection([simple]))
開發者ID:osmottawa,項目名稱:imports,代碼行數:18,代碼來源:create-extent.ts


注:本文中的geojson-helpers.writeFileSync函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。