Latest 2.1.1
Homepage https://github.com/visualNACert/GeometryUtilities
License LGPL2
Platforms ios 8.0, osx 10.10
Dependencies StringUtilities
Authors ,

Build Status codecov documentation pod platforms pod version pod license

Geometry Utilities

This is a small collection of geometry utilities to work with data in different projections, multiple polygons and polygon overlays:

  • Parse WKT and extract multiple polygons (implemented in Objective-C for performance’s sake).
  • Convert multiple polygons into single CGPathRef to be drawable with MapKit as a single polygon.
  • Convert from Mercator projection and WGS84 coordinate system.

API

// Extract polygons from a WKT string
let wkt = "MULTIPOLYGON(((0.0 0.0, 0.0 1.0, 1.0 1.0, 1.0 0.0)))"
let polygons = WKT.polygons(in: wkt)
let polygon = polygons.first
polygon?.coordinates() // (0, 0), (0, 1), (1, 1), (1, 0), (0, 0)

// Serialize polygons into a WKT string
let polygon = MKPolygon(
    coordinates: [
        CLLocationCoordinate2D(
            latitude: 0,
            longitude: 0
        ),
        CLLocationCoordinate2D(
            latitude: 1,
            longitude: 0
        ),
        CLLocationCoordinate2D(
            latitude: 1,
            longitude: 1
        ),
        CLLocationCoordinate2D(
            latitude: 0,
            longitude: 1
        )
    ]
)
polygon.wktString() // MULTIPOLYGON(((0.0 0.0, 0.0 1.0, 1.0 1.0, 1.0 0.0)))

Latest podspec

{
    "name": "GeometryUtilities",
    "version": "2.1.1",
    "summary": "A collection of utilities to handle geometry in WKT format",
    "description": "Collection of utilities to handle geometry in WKT format, multipolygons andnintegrate both in `MapKit`.",
    "homepage": "https://github.com/visualNACert/GeometryUtilities",
    "documentation_url": "https://visualnacert.github.io/GeometryUtilities",
    "license": {
        "type": "LGPL2",
        "file": "LICENSE"
    },
    "authors": {
        "visualNACert team": "",
        "Lluu00eds Ulzurrun de Asanza i Su00e0ez": "[email protected]"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.10"
    },
    "source": {
        "git": "https://github.com/visualNACert/GeometryUtilities.git",
        "tag": "2.1.1"
    },
    "ios": {
        "source_files": [
            "Source/{iOS}/**/*",
            "Source/*.{h,m,swift}"
        ]
    },
    "osx": {
        "source_files": [
            "Source/{macOS}/**/*",
            "Source/*.{h,m,swift}"
        ]
    },
    "dependencies": {
        "StringUtilities": [
            "~> 2"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This