当前位置: 首页>>代码示例>>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;未经允许,请勿转载。