sf-geojson-ios 4.2.5

sf-geojson-ios 4.2.5

Giat AppsTeamDaniel Barela 维护。



Simple Features GeoJSON iOS

Simple Features GeoJSON Lib

Simple Features Libraries 是在国家地理空间情报局(NGA)和 BIT Systems 协作下开发的。政府拥有“无限权利”,并将此软件发布以增加政府投资的影响,为开发者提供新的发展方向的机会。软件的使用、修改和分发权在 MIT 许可证 中规定。

Pull Requests

如果您想为此项目做出贡献,请提交一个 pull request。我们将审查 pull request 并讨论更改。本项目对所有 pull request 贡献都将按照 MIT 许可证发布。

根据 17 USC § 101,受开源许可证发布并由 NGA 员工修改的软件代码被视为“合作作品”;部分受版权保护,部分归公共领域,整体受非政府作者的版权保护,并必须根据原始开源许可证的条款发布。

关于

Simple Features GeoJSON 是一个用于将 Simple Feature 几何图形读入和写入 GeoJSON 的 iOS Objective-C 库。

用法

查看最新 Appledoc

读取

// NSString *content = ...

SFGGeometry *geometry = [SFGFeatureConverter jsonToGeometry:content];
SFGeometry *simpleGeometry = [geometry geometry];

/* Read as a generic GeoJSON object, Feature, or Feature Collection */
// SFGGeoJSONObject *geoJSONObject = [SFGFeatureConverter jsonToObject:content];
// SFGFeature *feature = [SFGFeatureConverter jsonToFeature:content];
// SFGFeatureCollection *featureCollection = [SFGFeatureConverter jsonToFeatureCollection:content];

写入

// SFGeometry *geometry = ...

NSString *content = [SFGFeatureConverter simpleGeometryToJSON:geometry];

SFGFeature *feature = [SFGFeatureConverter simpleGeometryToFeature:geometry];
NSString *featureContent = [SFGFeatureConverter objectToJSON:feature];

SFGFeatureCollection *featureCollection = [SFGFeatureConverter simpleGeometryToFeatureCollection:geometry];
NSString *featureCollectionContent = [SFGFeatureConverter objectToJSON:featureCollection];

NSDictionary *contentTree = [SFGFeatureConverter simpleGeometryToTree:geometry];

构建

Build & Test

使用 Xcode 和/或 CocoaPods 构建此仓库

pod repo update
pod install

在 Xcode 中打开 sf-geojson-ios.xcworkspace 或从命令行构建

xcodebuild -workspace 'sf-geojson-ios.xcworkspace' -scheme sf-geojson-ios build

从 Xcode 或命令行运行测试

xcodebuild test -workspace 'sf-geojson-ios.xcworkspace' -scheme sf-geojson-ios -destination 'platform=iOS Simulator,name=iPhone 14'

包含库

通过在 Podfile 中指定支持选项来包含此仓库。

CocoaPods 拉取

pod 'sf-geojson-ios', '~> 4.2.3'

从 GitHub 拉取

pod 'sf-geojson-ios', :git => 'https://github.com/ngageoint/simple-features-geojson-ios.git', :branch => 'master'
pod 'sf-geojson-ios', :git => 'https://github.com/ngageoint/simple-features-geojson-ios.git', :tag => '4.2.3'

将本地项目包含在内

pod 'sf-geojson-ios', :path => '../simple-features-geojson-ios'

Swift

要从 Swift 中使用,请从 Swift 项目的桥接头中导入 sf-geojson-ios 桥接头

#import "sf-geojson-ios-Bridging-Header.h"

读取

// var content: String = ...

let geometry: SFGGeometry = SFGFeatureConverter.json(toGeometry: content)
let simpleGeometry: SFGeometry = geometry.geometry()

/* Read as a generic GeoJSON object, Feature, or Feature Collection */
// let geoJSONObject : SFGGeoJSONObject = SFGFeatureConverter.json(toObject: content)
// let feature: SFGFeature = SFGFeatureConverter.json(toFeature: content)
// let featureCollection : SFGFeatureCollection = SFGFeatureConverter.json(toFeatureCollection: content)

写入

// let geometry : SFGeometry = ...

let content : String = SFGFeatureConverter.simpleGeometry(toJSON: geometry)

let feature : SFGFeature = SFGFeatureConverter.simpleGeometry(toFeature: geometry)
let featureContent : String = SFGFeatureConverter.object(toJSON: feature)

let featureCollection : SFGFeatureCollection = SFGFeatureConverter.simpleGeometry(toFeatureCollection: geometry)
let featureCollectionContent : String = SFGFeatureConverter.object(toJSON: featureCollection)

let contentTree : Dictionary = SFGFeatureConverter.simpleGeometry(toTree: geometry)

远程依赖关系