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


TypeScript turf.lineString函數代碼示例

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


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

示例1:

 feature.geometry.coordinates.map(coords => {
     const name = changeCase.title(feature.properties['BaseStreet'])
     const suffix = suffixLookup[feature.properties['SuffixType']]
     const direction = directionsLookup[feature.properties['PrefixDire']]
     const ref = feature.properties['SegID']
     const properties: any = {
         source: 'Lake County',
         highway: 'residential',
         maxspeed: feature.properties['SpeedLimit'] ? `${ feature.properties['SpeedLimit'] } mph` : undefined,
         name: [name, suffix, direction].join(' ').trim()
     }
     if (ref) {
         properties.ref = ref
         properties['source:ref'] = 'Lake County'
     }
     results.features.push(lineString(coords, properties))
 })
開發者ID:osmottawa,項目名稱:imports,代碼行數:17,代碼來源:parse-data.ts

示例2:

///////////////////////////////////////////

// -- Test featurecollection --
turf.featureCollection([point1, point2])
turf.featureCollection([point1, polygon1])
turf.featureCollection([polygon1, polygon2])
turf.featureCollection([lineString1, polygon1])
turf.featureCollection([lineString1, point1])

// -- Test feature --
turf.feature(point1)
turf.feature(polygon1)
turf.feature(lineString1)

// -- Test lineString --
turf.lineString(lineString1.geometry.coordinates)
turf.lineString(lineString1.geometry.coordinates, properties)

// -- Test multiLineString --
turf.multiLineString(multiLineString1.geometry.coordinates)

// -- Test point --
turf.point(point1.geometry.coordinates)
turf.point(point1.geometry.coordinates, properties)

// -- Test multiPoint --
turf.multiPoint(multiPoint1.geometry.coordinates)

// -- Test polygon --
turf.polygon(polygon1.geometry.coordinates, properties)
開發者ID:ArtemZag,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:turf-tests.ts


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