Simple Features Projection iOS
Simple Features Projection Lib
Simple Features Libraries 是在 国家地理空间情报局 (NGA) 与 BIT Systems 协同下开发的。政府拥有“无限权利”,并将释放此软件,通过为开发者提供将事物推向新方向的机会,以增加政府投资的影响。软件的使用、修改和分发权利在 MIT 许可证 中规定。
拉取请求
如果您想为此项目做贡献,请发起一个拉取请求。我们会审查拉取请求并讨论更改。本项目的所有拉取请求贡献将按照 MIT 许可证发布。
之前在开源许可证下发布并经过 NGA 员工修改的软件源代码被视为“共同作品”(参见 17 USC § 101);它部分受版权保护,部分属于公共领域,整体上受非政府作者版权保护,并必须根据原始开源许可证的条款发布。
关于
Simple Features Projection 是一个用于在Simple Feature 几何体之间执行投影转换的 iOS 库。
使用方法
查看最新的Appledoc
转换
// SFGeometry *geometry = ...
PROJProjection *projection1 =
[PROJProjectionFactory projectionWithAuthority:PROJ_AUTHORITY_EPSG
andIntCode:PROJ_EPSG_WEB_MERCATOR];
PROJProjection *projection2 =
[PROJProjectionFactory projectionWithAuthority:PROJ_AUTHORITY_EPSG
andIntCode:PROJ_EPSG_WORLD_GEODETIC_SYSTEM];
SFPGeometryTransform *transform =
[SFPGeometryTransform transformFromProjection:projection1
andToProjection:projection2];
SFGeometry *transformed = [transform transformGeometry:geometry];
构建
重要 - 确保您的 Mac 上安装了 autoconf
、automake
和 glibtoolize
工具。这些是构建 proj4-ios 依赖项所必需的。如果没有它们,pod install
将失败。获取这些工具的最简单方法是brew install
。
brew install automake
brew install libtool
使用 Xcode 和/或 CocoaPods 构建此仓库
pod repo update
pod install
在 Xcode 中打开 sf-proj-ios.xcworkspace 或从命令行构建
xcodebuild -workspace 'sf-proj-ios.xcworkspace' -scheme sf-proj-ios build
从 Xcode 或命令行运行测试
xcodebuild test -workspace 'sf-proj-ios.xcworkspace' -scheme sf-proj-ios -destination 'platform=iOS Simulator,name=iPhone 14'
包含库
参见关于automake
和glibtoolize
的上述备注。
通过在Podfile中指定支持选项来包含此存储库。
从CocoaPods中拉取
pod 'sf-proj-ios', '~> 5.1.3'
从GitHub中拉取
pod 'sf-proj-ios', :git => 'https://github.com/ngageoint/simple-features-proj-ios.git', :branch => 'master'
pod 'sf-proj-ios', :git => 'https://github.com/ngageoint/simple-features-proj-ios.git', :tag => '5.1.3'
作为本地项目包含
pod 'sf-proj-ios', :path => '../simple-features-proj-ios'
Swift
要使用Swift,请从Swift项目的bridging header中导入sf-proj-ios桥接头
#import "sf-proj-ios-Bridging-Header.h"
转换
// var geometry: SFGeometry = ...
let projection1: PROJProjection = PROJProjectionFactory.projection(withAuthority: PROJ_AUTHORITY_EPSG, andIntCode: PROJ_EPSG_WEB_MERCATOR)
let projection2: PROJProjection = PROJProjectionFactory.projection(withAuthority: PROJ_AUTHORITY_EPSG, andIntCode: PROJ_EPSG_WORLD_GEODETIC_SYSTEM)
let transform: SFPGeometryTransform = SFPGeometryTransform(from: projection1, andTo: projection2)
let transformed: SFGeometry = transform.transform(geometry)
远程依赖
- Simple Features (MIT许可) - Simple Features库
- Projections (MIT许可) - Projections库