All Projects → GEOSwift → Geoswift

GEOSwift / Geoswift

Licence: mit
The Swift Geometry Engine.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to Geoswift

Editor
An open source visual editor for the 'Mapbox Style Specification'
Stars: ✭ 1,167 (-7.89%)
Mutual labels:  geospatial, geo, cartography, maps
Maps Api For Javascript Examples
Self-contained examples for Maps API for JavaScript v3.
Stars: ✭ 130 (-89.74%)
Mutual labels:  geospatial, geo, maps
Openrailwaymap
An OpenStreetMap-based project for creating a map of the world's railway infrastructure.
Stars: ✭ 150 (-88.16%)
Mutual labels:  geospatial, geo, maps
Examples
Self-contained examples for the legacy Maps API for JavaScript.
Stars: ✭ 78 (-93.84%)
Mutual labels:  geospatial, geo, maps
pyturf
A modular geospatial engine written in python
Stars: ✭ 15 (-98.82%)
Mutual labels:  geojson, geo, geospatial
rafagas
Daily geospatial links curated by Raf Roset
Stars: ✭ 17 (-98.66%)
Mutual labels:  maps, cartography, geospatial
Go Geom
Package geom implements efficient geometry types for geospatial applications.
Stars: ✭ 456 (-64.01%)
Mutual labels:  geospatial, geojson, geo
turf-go
A Go language port of Turf.js
Stars: ✭ 41 (-96.76%)
Mutual labels:  geojson, geo, geospatial
GeoJSON.jl
Utilities for working with GeoJSON data in Julia
Stars: ✭ 46 (-96.37%)
Mutual labels:  geojson, geo, geospatial
Orb
Types and utilities for working with 2d geometry in Golang
Stars: ✭ 378 (-70.17%)
Mutual labels:  geospatial, geojson, geo
Agentmaps
Make social simulations on interactive maps with Javascript! Agent-based modeling for the web.
Stars: ✭ 822 (-35.12%)
Mutual labels:  geospatial, maps
Leaflet Dvf
Leaflet Data Visualization Framework
Stars: ✭ 678 (-46.49%)
Mutual labels:  geospatial, maps
Worldwindjava
The NASA WorldWind Java SDK (WWJ) is for building cross-platform 3D geospatial desktop applications in Java.
Stars: ✭ 526 (-58.48%)
Mutual labels:  geospatial, maps
Magellan
Geo Spatial Data Analytics on Spark
Stars: ✭ 507 (-59.98%)
Mutual labels:  geospatial, geojson
Wellknown
WKT <-> GeoJSON
Stars: ✭ 15 (-98.82%)
Mutual labels:  geospatial, geojson
Proj4.jl
Julia wrapper for the PROJ cartographic projections library
Stars: ✭ 23 (-98.18%)
Mutual labels:  geospatial, geo
Thematic Cartography
A short, friendly guide to basic principles of thematic mapping
Stars: ✭ 32 (-97.47%)
Mutual labels:  cartography, maps
Shapefile.jl
Parsing .shp files in Julia
Stars: ✭ 40 (-96.84%)
Mutual labels:  geospatial, geo
Khartis
Khartis - thematic mapping
Stars: ✭ 49 (-96.13%)
Mutual labels:  cartography, maps
Geo On Fire
A library to create high performance geolocation queries for Firebase. Checkout the demos: https://run.plnkr.co/plunks/AYaN8ABEDcMntgbJyLVW/ and https://run.plnkr.co/plunks/xJgstAvXYcp0w7MbOOjm/
Stars: ✭ 54 (-95.74%)
Mutual labels:  geospatial, geo

GEOSwift

CocoaPods Compatible Carthage Compatible SwiftPM Compatible Supported Platforms Build Status Code Coverage

Easily handle a geometric object model (points, linestrings, polygons etc.) and related topological operations (intersections, overlapping etc.). A type-safe, MIT-licensed Swift interface to the OSGeo's GEOS library routines.

For MapKit integration visit: https://github.com/GEOSwift/GEOSwiftMapKit
For MapboxGL integration visit: https://github.com/GEOSwift/GEOSwiftMapboxGL

Migrating to Version 5 or Later

Version 5 constitutes a ground-up rewrite of GEOSwift. For full details and help migrating from version 4, see VERSION_5.md.

Features

  • A pure-Swift, type-safe, optional-aware programming interface
  • WKT and WKB reading & writing
  • Robust support for GeoJSON via Codable
  • Thread-safe
  • Swift-native error handling
  • Extensively tested

Requirements

  • iOS 9.0+, tvOS 9.0+, macOS 10.9+ (CocoaPods, Carthage, Swift PM)
  • Linux (Swift PM)
  • Swift 5.1

GEOS is licensed under LGPL 2.1 and its compatibility with static linking is at least controversial. Use of geos without dynamic linking is discouraged.

Installation

CocoaPods

  1. Update your Podfile to include:

     use_frameworks!
     pod 'GEOSwift'
    
  2. Run $ pod install

Carthage

  1. Add the following to your Cartfile:

     github "GEOSwift/GEOSwift" ~> 8.0.0
    
  2. Finish updating your project by following the typical Carthage workflow.

Swift Package Manager

  1. Update the top-level dependencies in your Package.swift to include:

     .package(url: "https://github.com/GEOSwift/GEOSwift.git", from: "8.0.0")
    
  2. Update the target dependencies in your Package.swift to include

     "GEOSwift"
    

In certain cases, you may also need to explicitly include geos as a dependency. See issue #195 for details.

Usage

Geometry creation

// 1. From Well Known Text (WKT) representation
let point = try Point(wkt: "POINT(10 45)")
let polygon = try Geometry(wkt: "POLYGON((35 10, 45 45.5, 15 40, 10 20, 35 10),(20 30, 35 35, 30 20, 20 30))")

// 2. From a Well Known Binary (WKB)
let wkb: NSData = geometryWKB()
let geometry2 = try Geometry(wkb: wkb)

// 3. From a GeoJSON file:
let decoder = JSONDecoder()
if let geoJSONURL = Bundle.main.url(forResource: "multipolygon", withExtension: "geojson"),
    let data = try? Data(contentsOf: geoJSONURL),
    let geoJSON = try? decoder.decode(GeoJSON.self, from: data),
    case let .feature(feature) = geoJSON,
    let italy = feature.geometry
{
    italy
}

Topological operations

Let's say we have two geometries:

Example geometries

GEOSwift let you perform a set of operations on these two geometries:

Topological operations

Predicates:

  • equals: returns true if this geometric object is “spatially equal” to another geometry.
  • disjoint: returns true if this geometric object is “spatially disjoint” from another geometry.
  • intersects: returns true if this geometric object “spatially intersects” another geometry.
  • touches: returns true if this geometric object “spatially touches” another geometry.
  • crosses: returns true if this geometric object “spatially crosses’ another geometry.
  • within: returns true if this geometric object is “spatially within” another geometry.
  • contains: returns true if this geometric object “spatially contains” another geometry.
  • overlaps: returns true if this geometric object “spatially overlaps” another geometry.
  • relate: returns true if this geometric object is spatially related to another geometry by testing for intersections between the interior, boundary and exterior of the two geometric objects as specified by the values in the intersectionPatternMatrix.

Playground

Explore more, interactively, in the playground, which is available in the GEOSwiftMapKit project. It can be found inside GEOSwiftMapKit workspace. Open the workspace in Xcode, build the GEOSwiftMapKit framework and open the playground file.

Playground

Contributing

To make a contribution:

  • Fork the repo
  • Start from the main branch and create a branch with a name that describes your contribution
  • Run $ xed Package.swift to open the project in Xcode.
  • Run $ swiftlint from the repo root and resolve any issues.
  • Update GEOSwift.xcodeproj: After making your changes, you also need to update the Xcode project. You'll need a version of Carthage greater than 0.36.0 so that you can use the --use-xcframeworks option. Run $ carthage update --use-xcframeworks to generate geos.xcframework. Then open the GEOSwift.xcodeproj and ensure that it works with your changes. You'll likely only need to make changes if you've added, removed, or renamed files.
  • Sign in to travis-ci.com (if you've never signed in before, CI won't run to verify your pull request)
  • Push your branch and create a pull request to main
  • One of the maintainers will review your code and may request changes
  • If your pull request is accepted, one of the maintainers should update the changelog before merging it

Maintainer

Past Maintainers

License

  • GEOSwift was released by Andrea Cremaschi (@andreacremaschi) under a MIT license. See LICENSE for more information.
  • GEOS stands for Geometry Engine - Open Source, and is a C++ library, ported from the Java Topology Suite. GEOS implements the OpenGIS Simple Features for SQL spatial predicate functions and spatial operators. GEOS, now an OSGeo project, was initially developed and maintained by Refractions Research of Victoria, Canada.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].